Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 4

301 redirect error with REST API v3

I send a GET request to

`https://api.github.com/repos/aplteam/meddy/releases/latest`

with  'Accepted: 'application/vnd.github.v3+json'

and get a 301.

The "Location" field in the header reads

`https://github.com/repos/aplteam/meddy/releases/latest`

When I use this I get a 404. 

I am lost...

3 Replies
Copilot Lvl 3
Message 2 of 4

Re: 301 redirect error with REST API v3

Obviously I am doing something wrong because when I tried the same (apparently) with .NET it worked.

 

However, doing something wrong should certainly not result in a 301 that points into nowhere land.

Highlighted
Pilot Lvl 2
Message 3 of 4

Re: 301 redirect error with REST API v3

Not sure if this was just a typo you made while typing up this post, but you seem to be using Accepted instead of Accept in your headers. This can in return throw an error and cause you to receive numerous HTTP error codes.

 

Hope this fixes your problem! If it persists, please reply back to my message and we'll see what we can come up with next!

 

Gavin R. Isgar - Freelance Software Developer
Copilot Lvl 3
Message 4 of 4

Re: 301 redirect error with REST API v3

This was a typo in the post.

 

However, I found the cause of the problem. Of course it was me: I'd specified "github.com" in the HTTP "Host" header field rather than the correct "api.github.com".

 

That Github answers this with a 301 that contains an invalid "Location" header is another matter.

 

Thanks.