Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to upload a JSON file using Parse's REST API with no success so far.

The request I am trying to make is the following:

curl -X POST \
-H "X-Parse-Application-Id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "X-Parse-REST-API-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "name" : "myName" }' \
https://api.parse.com/1/files/test.json

The reponse is as follows:

{"code":1,"error":"internal error"}

I believe my request is correct, the JSON is valid, my Application ID and REST API Key are also correct.

To top it off, I can successfully upload an invalid JSON. For example, the same request with an invalid JSON:

curl -X POST \
-H "X-Parse-Application-Id: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "X-Parse-REST-API-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '#{ "name" : "myName" }' \
https://api.parse.com/1/files/test.json

Returns a correct reponse JSON:

{
    "url":"http://files.parsetfss.com/e88af32e-2e48-400b-aa1c-2f167f3d2785/tfss-550782bd-718c-46b1-bac1-9e366f957d7a-test.json",
    "name":"tfss-550782bd-718c-46b1-bac1-9e366f957d7a-test.json"
}

Has anyone had similar problems, or could anyone point me what I am doing wrong?

[]'s!

share|improve this question
    
What happens if you try with Content-Type: text/plain? –  Timothy Walters Jun 30 at 20:44
    
I still get the same results on both cases. Am I supposed to use a custom class if I want to upload a JSON file. –  Bruno Pezzolo Jul 1 at 17:09
    
I think you should log a bug from the help page: parse.com/help –  Timothy Walters Jul 1 at 21:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.