Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of gitlab API for user snippets

Im currently trying to write a little addin for my IDE so i can create snippets on my gitlab. I have checked the API and it seems its possible to create snippets associated with a project using /api/v3/project/id/snippet and the according POST parameters. However I dont really want to associate the snippets with a particular project and in the web interface its possible to choose "My Snippets" and when you create a snippet there you dont have to attribute it to a project. I wonder if there is also an API to create a snippet thats not linked to a project but rather to my account?

Also according to https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/project_snippets.md#create-new-snippet its not possible to choose the visibility of the snippet while in the web interface you can chosse private, public or internal. Is there something else? Is the API out of date? Thanks in advance.

like image 332
Cromon Avatar asked Nov 10 '22 21:11

Cromon


1 Answers

There is no REST API to change or view user snippets.

To set visibility, you can use attribute visibility_level (although undocumented, it is actually required). It uses the same level numbers as projects.

like image 180
StenSoft Avatar answered Jan 04 '23 03:01

StenSoft