Github Api - how to track moved repositories / projects?

I am having problems with the application I am creating that tracks some github repositories through the github API. When I manually move or rename a project (on github) that tracks the application, I lose it (getting 404 when I call the old api url). I notice that when I go through the browser to my old project url, I get 301 and get redirected to the correct page. Is there an easy way to find out the new project location via api? Perhaps by searching for projects using the id attribute or something else? Thank!

Example: old: github.com/api/v3/repos/group/app1 renamed to: github.com/api/v3/repos/group/app2

when i call github.com/api/v3/repos/group/app2 i get 404 when i go to github.com/group/app1 i get 301 and redirected to github.com/group/app2

Greetings.

+4
source share
1 answer

I came across this exact issue and was able to get really useful information from Github support.

Currently, the API does not redirect repositories or rename users, for example github.com, but from April 17, 2015 you can redirect the preview repository .

6to5/6to5, babel/babel, . , https://api.github.com/repos/6to5/6to5 404, , application/vnd.github.quicksilver-preview+json Accept:

$ curl -i -H "Accept: application/vnd.github.quicksilver-preview+json" https://api.github.com/repos/6to5/6to5

301 url, , :

{
  "message": "Moved Permanently",
  "url": "https://api.github.com/repositories/24560307",
  "documentation_url": "https://developer.github.com/v3/#http-redirects"
}

id ( ) ( ) .

babel/babel née 6to5/6to5 . repo id 24560307. /repositories/:id (, https://api.github.com/repositories/24560307) , .

GitHub :

.

API Github?

, 6to5/6to5 babel/babel. curl -i https://github.com/6to5/6to5 301 "", . curl -i https://api.github.com/repos/6to5/6to5 404.

, Location API? , HEAD, API, , ? / (https://github.com/codetriage/codetriage/issues/228).

, .

, -


, O-I,

- API , github.com. -, ( , ), promises . , !

API - , API, ID ( , ).

, github/linguist 1725199:

https://api.github.com/repos/github/linguist

, , ID:

https://api.github.com/repositories/1725199

, , , , HEAD github.com, , , , .

, , .

Cheers,


, O-I,

, , API . , . https://developer.github.com:

https://developer.github.com/changes/2015-04-17-preview-repository-redirects/

, , .

,

+7

All Articles