how can I avoid the parsing errors for
curl -H 'Accept: application/vnd.github.VERSION.raw' -XPUT -g 'https://api.github.com/repos/USER/l1/contents/PATH/FILENAME.json?ref=gh-pages&access_token=57eef6413b12cb439b837b8fc4751b3291650de1' -d '{
"message": "update from api",
"committer": {
"name": "USER",
"email": "[email protected]"
},
"content": "[{"a": "aaa","b": "bbb"}]",
"sha": "c321fe9f6418053ecb87eb3cd2518a4xdfc83ebf"
}'
Answer:
{
"message": "**Problems parsing JSON**",
"documentation_url": "https://developer.github.com/v3/repos/contents/"
}
Instead of
"[{"a": "aaa","b": "bbb"}]"
I've tried
"[{\"a\": \"aaa",\"b\": \"bbb\"}]"
but then I get the following error:
{
"message": "**content is not valid Base64**",
"documentation_url": "https://developer.github.com/v3/repos/contents/"
}
Best,
Jonathon Reinhart
139k38 gold badges266 silver badges347 bronze badges
-
Stack overflow isn't a forum. If you look at other questions and answers, you'll see that we don't edit questions and mark their titles as "SOLVED". Instead, you are expected to up-vote all answers that help, and accept the answer that best solves your problem by clicking the green check mark next to it.Jonathon Reinhart– Jonathon Reinhart2017年02月18日 15:40:42 +00:00Commented Feb 18, 2017 at 15:40
-
Also, don't edit your question to drastically change what it is asking. Doing so will render all of the answers invalid or irrelevant. If you have more questions, ask a new question.Jonathon Reinhart– Jonathon Reinhart2017年02月18日 15:42:48 +00:00Commented Feb 18, 2017 at 15:42
1 Answer 1
If you open the URL to the documentation given in the error response, you'll see that the content needs to be Base64 encoded.
answered Feb 9, 2017 at 12:40
Jonathon Reinhart
139k38 gold badges266 silver badges347 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default