gitlab:tips:api
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| gitlab:tips:api [2016/01/26 22:44] – [Send an email to the members of a GitLab group] cedric | gitlab:tips:api [2016/01/27 07:35] (current) – cedric | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | GitLab provides [[http:// | + | GitLab provides [[http:// |
| - | This tutorial presents how to use the API of GitLab with Python. | + | This tutorial presents how to use the API of GitLab with [[https:// |
| - | For the examples below we will use the instance https:// | + | > For the examples below we will use the instance https:// |
| ====== Get the list of users registered in GitLab ====== | ====== Get the list of users registered in GitLab ====== | ||
| - | This first example is fairly easy and uses the [[http:// | + | This first example is fairly easy and takes advantage of the [[http:// |
| <code python> | <code python> | ||
| Line 28: | Line 28: | ||
| print user[" | print user[" | ||
| </ | </ | ||
| + | |||
| + | The // | ||
| + | |||
| ====== Send an email to the members of a GitLab group ====== | ====== Send an email to the members of a GitLab group ====== | ||
| - | Again, this is pretty easy. We will need to use the resource | + | Again, this is pretty easy. We will need the [[http:// |
| - | In order to send the email, we will use the [[http:// | + | In order to send the email, we will simply |
| The Mutt command will look like this: | The Mutt command will look like this: | ||
| Line 43: | Line 46: | ||
| As you can see, Mutt needs three parameters: | As you can see, Mutt needs three parameters: | ||
| * the subject of the email. Will be given in parameter; | * the subject of the email. Will be given in parameter; | ||
| - | * the message to be sent. Will be given through a Unix pipeline (*message.txt*); | + | * the message to be sent. Will be given through a Unix pipeline (//message.txt//); |
| * the list of recipients (members of the GitLab group). Will be given in parameter as the result of a Python script. | * the list of recipients (members of the GitLab group). Will be given in parameter as the result of a Python script. | ||
| - | As you can expect the Python script will use the API of GitLab in order to get the list of recipients. | + | As you can expect, the Python script will use the API of GitLab in order to get the list of recipients. |
| Below you will find a working script: | Below you will find a working script: | ||
| Line 75: | Line 78: | ||
| </ | </ | ||
| - | Only active users (*user[" | + | A first request to the //Groups// resource returns the list of members in the group. The '' |
| + | |||
| + | Only active users (//user[" | ||
gitlab/tips/api.1453844653.txt.gz · Last modified: by cedric
