API inconsistency /snippets and /projects

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

The snippets API has an annoying inconsistency for admins.

When I'm querying /snippets while:

  • logged in as administrator I get an empty response [].
  • not logged in at all I get {"message":"401 Unauthorized"}
  • logged in as the user that created a snippet I get a list of those snippets.

When I'm querying the /projects API while:

  • logged in as administrator I get all projects including Internal and Private projects of other users.
  • not logged in I get all public projects.
  • logged in as a regular user I get all projects that user has access to.

And more funnily the Web-UI has a different behavior for Snippets too:

  • When not logged in it shows all public snippets
  • When logged in as administrator I can't see any snippets and it just shows the screen to create the first one.

Then there is also /snippets/public and /snippets/all. These two add to the inconsistency pile here. Both just returns a HTTP-401 when not logged in and the later has no equivalent /projects/all endpoint.

Then the API replies are also different, most notable:

  • snippets has title where as projects has name
  • snippets has no path_with_namespace.

(I did not try what happens if also snippets within a project exist)

Edited by 🤖 GitLab Bot 🤖