Is there any way to get an id
of the project via GitLab API .
I created a project using GitLab API providing the project name -
curl -kX POST --header "PRIVATE-TOKEN: <access_token>" https://gitlab.example.com/api/v4/projects/my_app&visibility=internal
It returns expected result with project information like links
, id
, user
, namespace
etc.
Now I want to create issue
or create a branch
. I need the project id
now.
So how can I retrieve the id
of my project my_app
. (Not from UI).
I didn't find any API query that I can create issue
or branch
without using project id
.
I always need id
Issues API
POST /projects/:id/issues
As well I didn't find any API query that I can retrieve the id
using the project name
Only thing I can use by Search API and use project name
curl -kX GET --header "PRIVATE-TOKEN: <access_token>" https://gitlab.example.com/api/v4/search?scope=projects&search=my_app
But it provides whole lot of information. I only need to retrieve project id
. No idea how to get the project id
?
There is python-gitlab lib by which I can do, similar stuff like using curl
.
- Get projects ( gives most recent 20 projects'
name
andid
inyaml
format)gitlab project list
- Create project
gitlab -o yaml project create --name "my_app_cli" --visibility "internal"
- Create Issue of a project
gitlab -o yaml project create-issue --id ID
Here also I need to provideid
.
But in this library also, there is no option to retrieve project id
.
Same as the API, to create any branch, issue etc, I need to use id
of the created project. I don't want to put manually the id
in the api
or while using cli
Is there any workaround to get the id via api
or cli
using project name
?
Or Is there any workaround to create issue
, branch
etc. without using the id
via api
or cli
?
api v3
. I tried but not get the desired result. – Daedalus