user2856064
user2856064

Reputation: 553

How to get specific repo from specific user using github api?

I use

https://api.github.com/users/ahfarmer/repos

it works. Now I want to get specific repo, just one repo through repository name like:

https://api.github.com/users/ahfarmer/repos/calculator

it does not work. How to get this only one repo using github api?

Upvotes: 1

Views: 692

Answers (1)

cody
cody

Reputation: 11157

The pattern is:

GET /repos/:owner/:repo

So in this case, the endpoint would be https://api.github.com/repos/ahfarmer/calculator

Result:

$ curl -s https://api.github.com/repos/ahfarmer/calculator | head -n 10
{
  "id": 70841075,
  "node_id": "MDEwOlJlcG9zaXRvcnk3MDg0MTA3NQ==",
  "name": "calculator",
  "full_name": "ahfarmer/calculator",
  "private": false,
  "owner": {
    "login": "ahfarmer",
    "id": 597825,
    "node_id": "MDQ6VXNlcjU5NzgyNQ==",

Upvotes: 4

Related Questions