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

查看:26
本文介绍了如何使用邮递员的 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": "我的提交信息",提交者":{"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

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

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