3

I would like to know if there is a way to get the languages (percentage per language) used in a project by using the API provided by GitLab. I checked their documentation but I didn't see anything about that or maybe I missed it.

I know that they use the Linguist library but I'm developping an application that's is not in Ruby and I'm looking for a way to integrate theses percentages.

Jordi Vicens
  • 696
  • 7
  • 17

2 Answers2

12

As of 10.8.x, Gitlab added a new API entrypoint, exposing languages used in a specific repository.

Usage is straight forward :

curl --header "PRIVATE-TOKEN: <__ACCESS_TOKEN__>" https://gitlab.mydomain.com/api/v4/projects/<ID>/languages

docs : https://docs.gitlab.com/ee/api/projects.html#languages

Hope this helps!

Justin T.
  • 3,643
  • 1
  • 22
  • 43
4

Looks like there's no endpoint to do this right now as the data for language repartition is sent in inline javascript. But it might become available as they refactor the code (see this and this)

Jawad
  • 4,457
  • 1
  • 26
  • 29