Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

GraphQL not identifying renamed repos, not providing redirection context

I'm trying to convert some of our REST api calls over to GraphQL calls, but I am seeing some discrepancies in how GraphQL handles, or doesnt handle redirection.  With the older REST APIs when I would issue a request for Pull Request details given the older repo name I would get a 301 status indicating that the repo had been relocated and I could then reissue the request to the new location or using the new repo name.  However, with the GraphQL APIs, I get a 200 status and the only error details I get are that the repository is not found.

 

Original Repo: https://github.myEnterprise.com/MyOrganization/advanced-worklist-filtering

Renamed Repo: https://github.myEnterprise.com/MyOrganization/worklist-filtering

 

Was this a conscious decision, something that hasn't been ported over or a miss in the information provided in the GraphQL response.  Any help would be appreciated.

1 Reply
Community Manager
Message 2 of 2

Re: GraphQL not identifying renamed repos, not providing redirection context

Hi @sdlf2b,

 

My apologies for the delay, I've just noticed I've replied on a different thread :facepalm: If this request is for an enterprise instance we would need you to please contact us at https://github.com/contact with the info so we can look into that further. Otherwise, the below steps should resolve your issue!

 

For the GraphQL API v4 for GitHub.com, fetching a repository's previous name will resolve to the new name automatically.

 

For example, https://github.com/gojuno/mainframer will redirect to https://github.com/buildfoundation/mainframer.

 

Fetching gojuno/mainframer in the GraphQL Explorer will resolve to the updated name:

query {
  repository(owner:"gojuno", name:"mainframer") {
    nameWithOwner
  }
}

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!