3

How do I do dashboard with information from my GitLab repo? I don't know how I get information about builds, commits and files and create dashboard with this information. Any idea? Thank you very much.

Samm
  • 31
  • 2

1 Answers1

1

You can use GitLab's API to obtain the information from GitLab. You will need to have an user account which can access a particular project. Get this user's "Private Token" from the /profile/account page and then you can make requests for which you would get a JSON response.

Retrieving latest commits

curl -H "PRIVATE-TOKEN: [TOKEN]" \
"https://[HOST]/api/v3/projects/[PROJECT ID]/repository/commits"

Retrieving latest builds

curl -H "PRIVATE-TOKEN: [TOKEN]" \
"https://[HOST]/api/v3/projects/[PROJECT ID]/repository/builds"

These are examples using curl. Depending on the programming language you are going to use, you will have to make a GET request while setting a HTTP header (that is what -H in my example stands for) named PRIVATE-TOKEN.

tmt
  • 7,611
  • 4
  • 32
  • 46
  • 1
    @EmersonMacedo, isn't the API not providing the information you need or are you facing some other problem? – tmt Sep 27 '16 at 07:26