I'm trying to star/unstar repository with the GitHub REST API, but it isn't working properly.
According to the document, I should use PUT to star a repository.
But it isn't working; the response is always Not Found 404
.
The URL is not wrong.
I renewed my access token but is still not working.
I made another account, set Content-Length as 0 in the header but it still doesn't work.
I tried with other repositories but it's still not working. And When I create a new account accessToken, I checked all of the scopes, doesn't work either. Also, Unstar (delete) sends the same response too.
Not found 404. All the other API calls work fine.
Please help.
It looks like you tried to attach your owner and repository as query parameters.
If you are referring to this API call (PUT /user/starred/{owner}/{repo}
), then you need to include them as positional parameters instead. Update your url
:
let url = URL(string:
"https://api.github.com/user/starred/\(repoModel.ownerName)/\(repoModel.repoName)"
);