【问题标题】:400 Problems parsing JSON - GitHub API and POSTMAN using OAuth解析 JSON 的 400 个问题 - GitHub API 和 POSTMAN 使用 OAuth
【发布时间】:2015-11-02 21:19:35
【问题描述】:

我想通过 GitHub API 在我的私人仓库中创建一个文件。
https://developer.github.com/v3/repos/contents/#create-a-file

PUT /repos/:owner/:repo/contents/:path

我正在使用 Postman 进行测试,并且已经通过 OAuth 授权。

https://api.github.com/repos/user/reponame/contents/test.txt?message=Myfirstmessage&content=SGVsbG8gV29ybGQgaW4gQmFzZTY0IQ==

错误消息是:“解析 JSON 的问题”

但问题到底出在哪里?

【问题讨论】:

  • 您将数据作为 GET 参数发送,将其作为 PUT 请求的请求正文发送,如文档中所述。还要确保您的数据是有效的 json 对象。

标签: json github oauth github-api postman


【解决方案1】:

我认为你必须使用来自body / binarychoose file。我刚刚在 github 上创建问题时遇到了同样的问题。将属性放入body / raw / json 解决了这个问题。

【讨论】:

    猜你喜欢
    • 2017-04-06
    • 2018-07-19
    • 1970-01-01
    • 2020-09-08
    • 2019-01-30
    • 2015-11-11
    • 2020-10-17
    • 1970-01-01
    相关资源
    最近更新 更多