如何使用邮递员的github API [英] How to use github api from postman

查看:143
本文介绍了如何使用邮递员的github API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

任何人都可以打电话给我如何在邮递员中使用此api.

我有我的公共github帐户:

你能帮我这个忙吗

解决方案

我刚刚想出了..在这里发布我的答案,这样,如果有人遇到相同的问题,那么可以为他们提供帮助.

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

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

添加正文:

  {"message":我的提交消息","committer":{"name":我的名字","email":我的电子邮件"},"content":"base64encoded"} 

标题:内容类型:application/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

这篇关于如何使用邮递员的github API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆