User Tools

Site Tools


gitlab:tips:api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gitlab:tips:api [2016/01/27 06:58] cedricgitlab:tips:api [2016/01/27 07:35] (current) cedric
Line 2: Line 2:
 GitLab provides [[http://doc.gitlab.com/ce/api/ | a powerful API]] that lets you interact programmatically with a GitLab instance in order to automate a lot of things. GitLab provides [[http://doc.gitlab.com/ce/api/ | a powerful API]] that lets you interact programmatically with a GitLab instance in order to automate a lot of things.
  
-This tutorial presents how to use the API of GitLab with Python.+This tutorial presents how to use the API of GitLab with [[https://www.python.org | Python]]. Of course you can use your favorite language.
  
 > For the examples below we will use the instance https://gitlab.example.org. Of course you can use https://gitlab.com.  > For the examples below we will use the instance https://gitlab.example.org. Of course you can use https://gitlab.com. 
Line 28: Line 28:
         print user["username"], user["email"]         print user["username"], user["email"]
 </code> </code>
 +
 +The //requests// library is used to query the API and the //json// library is used to parse the result received from the server. Here the result is simply a list of users.
 +
  
 ====== Send an email to the members of a GitLab group ====== ====== Send an email to the members of a GitLab group ======
Line 33: Line 36:
 Again, this is pretty easy. We will need the [[http://doc.gitlab.com/ce/api/groups.html | Groups]] resource and the [[http://doc.gitlab.com/ce/api/users.html | Users]] resource. Again, this is pretty easy. We will need the [[http://doc.gitlab.com/ce/api/groups.html | Groups]] resource and the [[http://doc.gitlab.com/ce/api/users.html | Users]] resource.
  
-In order to send the email, we will simply use the [[http://www.mutt.org/ | Mutt] email client.+In order to send the email, we will simply use the [[http://www.mutt.org/ | Mutt]] email client.
  
 The Mutt command will look like this: The Mutt command will look like this:
gitlab/tips/api.1453874281.txt.gz · Last modified: 2016/01/27 06:58 (external edit)