After reading the documentation on GitLab's API I could only find the following example URL:
https://gitlab.example.com/api/v4/
But I'm wondering what the root URL of the API of my projects on GitLab is?
I've tried https://gitlab.com/api/v4/
with the Private-Token
header set to a Personal Access Token I've created for myself, but it always returns 401: Unauthorized
.
What is the correct URL and method to connect to GitLab's API?
The https://gitlab.example.com/api/v4/
is API address of your GitLab instance (if you are using GitLab.com, choose https://gitlab.com/api/v4/
instead) , and /api/v4/
is a prefix and should be used for all scenarios!
GitLab API provides so many resources, see: GitLab API
You need to get your project's releases (Projects API):
curl --header "PRIVATE-TOKEN`:` ${YOUR_TOKEN}" http://gitlab.example.com/api/v4/projects/${PROJECT_ID}/releases/
You want to create a new Issue (Issue API):
curl --header 'Content-Type:application/json' --header "PRIVATE-TOKEN`:` ${YOUR_TOKEN}" --request POST "http://gitlab.example.com/api/v4/projects/${PROJECT_ID}/issues?title=${ISSUE_TITLE}&labels=${LABELS}&description=${ISSUE_DESCRIPTION}"
Be careful about access tokens. You have to create a personal access token, not a deploy token.
How to create access token
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With