Gitlab API returns 404 for various non obvious reasons
Created by: darklajid
Trying to create migration scripts from an existing gitorious installation.
After banging my head against the API for a while (actual issue: Valid JSON POSTed to api/v3/users returned 404, GETing that resource listed all users as expected) I stumbled upon a chain of issues:
https://github.com/gitlabhq/gitlabhq/issues/3526
closed in favor of..
https://github.com/gitlabhq/gitlabhq/issues/4209
which was closed due to no response from the poster. The magic information in that issue? The API actually returns 404 for random reasons, like 'password is not long enough', without any information in the logs or in the result.
The caller receives just {"message":"404 Not Found"} Using omnibus-gitlab's gitlab-ctl tail to look at all relevant logs, nothing hints at the root cause.
In addition, the information in the ticket 4209 is wrong/outdated it seems: My initial tests with a too short password ('foo' - hey, I'm testing and playing with scripts to migrate things. It's not that I plan to use that password, ever) caused me to fail, following the advice in 4209 to post at least 6 chars still failed ('foo123') with the same error, arbitrary retrying with 8 chars ('foo12345') works.
The API is awesome, but this really needs some love. The idea of a restful API should be that it's discoverable. I'd hope for:
- better error messages, at least on the server, preferably for the client as well
- a status code that makes sense. 404/not found doesn't/means something else.