Search code examples
gitlab-api

How do you get the comments on a user's snippets using the gitlab API?


In the documentation for the gitlab api, it tells you how to get the notes for a snippet in a particular project by doing:

GET /projects/:id/snippets/:snippet_id/notes

However, this does not work for snippets that the user has created that do not belong to a particular project (i.e. those in /dashboard/snippets).

Is there a way to get the comments on these snippets using the gitlab api as well? I could not find anything in the snippets API docs either.


Solution

  • It's not documented, but you can access snippets without a project just by altering the endpoint: Instead of GET /projects/:id/snippets/:snippet_id/notes try /snippets/:snippet_id/notes. Everything else about interacting with snippets appears to be the same, just the endpoint changes.