如何使用邮递员的 github api邮递员、如何使用、api、github

由网友(停靠在你身边〃)分享简介:我想通过邮递员使用 github api 在我的 github 帐户上创建一个文件.github api 用于在 github 帐户上创建文件:PUT/repos/:owner/:repo/contents/:path谁能告诉我如何在邮递员中使用这个 api.我有我的公共 github 帐户:你能帮帮我吗 解决方案 我...

我想通过邮递员使用 github api 在我的 github 帐户上创建一个文件.

github api 用于在 github 帐户上创建文件:

PUT/repos/:owner/:repo/contents/:path
使用GitHub API上传文件及GitHub做图床

谁能告诉我如何在邮递员中使用这个 api.

我有我的公共 github 帐户:

你能帮帮我吗

解决方案

我刚刚想通了.. 在这里发布我的答案,以便如果有人面临同样的问题,那么这可以帮助他们.

在邮递员中,使用以下 URL 设置为 PUT 请求

https://api.github.com/repos/YourUsername/YourRepo/contents/file.txt

添加正文:

{"message": "我的提交信息",提交者":{"name": "我的名字",电子邮件":我的电子邮件"},内容":base64编码"}

标题:内容类型:应用程序/json授权:令牌

参考下面的截图:

希望这会有所帮助.谢谢

i want to create a file on my github account using github api through postman.

github api to create a file on github account:

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

can anyone tel me how to use this api in postman.

i have my public github account : https://github.com/ritzygithub/myfirstRepo

and in postman header i set

Authorization type to OAuth 2
Authorization : token <token>
PUT request with url: https://api.github.com/repos/ritzygithub/myfirstRepo/

Can you please help me out in this

解决方案

i just figured it out.. posting my answer here so that if anyone is facing same issue then this can help them.

In postman, set as PUT request with below URL

https://api.github.com/repos/YourUsername/YourRepo/contents/file.txt

Add Body:

{
  "message": "my commit message",
  "committer": {
    "name": "My name",
    "email": "my email"
  },
  "content": "base64encoded"
}

Header: Content-Type : application/json Authorization : token

Refer below Screenshot:

Hope this helps. Thanks

阅读全文

相关推荐

最新文章