Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get repository languages with the GitLab API

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.

like image 592
Mohamed El Mouctar HAIDARA Avatar asked Nov 15 '25 01:11

Mohamed El Mouctar HAIDARA


1 Answers

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!

like image 130
Justin T. Avatar answered Nov 17 '25 20:11

Justin T.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!