javascript - trigger.IO ajax -> trying to attach file to a Parse model -


i'm trying attach image file model in parse using rest api , triggerio; unsuccessful.

i getting error:

'{"type":"expected_failure","content":"{\\"code\\":107,\\"error\\":\\"this endpoint supports content-type: application/json requests, not application/x-www-form-urlencoded.\\"}","statuscode":"400","message":"http error code received server: 400"} [71.87s]' 

this relevant code block:

attachimg: (data) ->     uploaddata =         "picture": {             "name": data,             "__type": "file"         }     forge.request.ajax         type: "post",          url: "https://api.parse.com/1/classes/workoutlog",         data: uploaddata,         datatype: "json"         headers:              "x-parse-application-id": 'my-app-id',             "x-parse-rest-api-key": 'my-rest-api-key',             "content-type": 'application/json'         success: (data) ->             debug "file attached"         error: (err) ->             debug err 

i've decided on using different method attaching files models in parse associating file's url string once uploaded column on class.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -