Search code examples
jsongitlabgitlab-api

Gitlab and JSON format


I have a problem with the API of Gitlab. I would like to export the issues of my project to a csv file. So before, i try to use the API and this command:

curl -H "PRIVATE-TOKEN: mytoken" https://mygitlab/projects/4/issues

My problem is the output is on html mode but i would like json format. I don't understand because in the api it's specified:

The API uses JSON to serialize data. You don't need to specify .json at the end of an API URL.

Any idea?


Solution

  • The URL you're trying to use is incorrect.

    the format is: https://yourgitlab/api/v3/projects/4/issues

    So, basically you missed the api/v3 part and you're not calling the api, but requesting an HTML page.

    By the way, when I look at projects/4/issues I think that 4 is the value from an API sample. Make sure to use your project id instead.