Skip to content

Instantly share code, notes, and snippets.

@mamund
Created February 6, 2014 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mamund/8836781 to your computer and use it in GitHub Desktop.
Save mamund/8836781 to your computer and use it in GitHub Desktop.
possible cj extension to support uploads. if "file" property appears in the "template" object then client SHOULD use multipart/form-data for sending the request body.
// cj write template
{
"template" : {
"data" : [
{"name" : "qwe", "value" : ""},
{"name" : "rty", "file" : ""}
]
}
}
Content-type: multipart/form-data, boundary=AaB03x
--AaB03x
content-disposition: form-data; name="document"
Content-Type: application/vnd.collection+json
{ "template": {
"data": [
{ "name": "qwe", "value": "my picture" }
]
}
--AaB03x
Content-disposition: attachment; name="rty"; filename="portrait.tiff"
Content-type: image/tiff
Content-Transfer-Encoding: binary
...contents...
--AaB03x--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment