3 POST api
John Crepezzi edited this page 2014-06-12 11:02:45 -07:00

What do I send?

There are two ways to send data up to become a paste on a haste-server:

Raw:

  • POST: /documents
  • Content-type: text/plain
  • Request body: contents of paste
  • Response: See below

Form Data:

  • POST: /documents
  • Content-type: multipart/form-data
  • Request body: A multipart form data encoded body, with a single key named "data" which holds the paste
  • Response: See below

NOTE: For more detail on the how multipart form bodies should be structured, see: http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4

What do I get back?

A JSON document (content-type: application/json) containing a single Key-Value, ex:

{ "key": "as8fj2j2n" }