doc.html 3.5 KB
Newer Older
1
2
{% extends "nm2-base.html" %}
{% load i18n %}
3
4
5
6
7

{% block content %}

<h1>Debian New Member - API documentation</h2>

Enrico Zini's avatar
Enrico Zini committed
8
9
10
11
<h2>Authentication</h2>

<p>If you are using a browser Debian SSO authentication works as usual. If
you are using a script and public access is not enough for you, you can use
12
<a href="{% url 'apikeys:list' %}">API keys</a>. For example:
Enrico Zini's avatar
Enrico Zini committed
13
<pre>
Enrico Zini's avatar
Enrico Zini committed
14
curl -H "Api-Key: YourAPIKeyValue" {% url 'api:status' %}
Enrico Zini's avatar
Enrico Zini committed
15
16
17
</pre>
</p>

Enrico Zini's avatar
Enrico Zini committed
18
<h2>{% url 'api:people' %}</h2>
Enrico Zini's avatar
Enrico Zini committed
19
20
21
22
23

<p>Lists people known to the system.</p>

<p>GET parameters can be used to filter results:</p>

24
<table class="table table-sm">
Enrico Zini's avatar
Enrico Zini committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    <thead>
        <tr><th>key</th><th>value</th></tr>
    </thead>
    <tbody>
        <tr><td>cn</td><td>First name</td></tr>
        <tr><td>mn</td><td>Middle name</td></tr>
        <tr><td>sn</td><td>Last name</td></tr>
        <tr><td>email</td><td>E-Mail</td></tr>
        <tr><td>uid</td><td>Debian account name</td></tr>
        <tr><td>fpr</td><td>OpenPGP key fingerprint</td></tr>
        <tr><td>status</td><td>Status in the project (as a tag like 'dd_u' or 'dm')</td></tr>
        <tr><td>fd_comment</td><td>FD comments (ignored unless authenticated as
                FD member or DAM)</td></tr>
    </tbody>
</table>

41
42
43
44
<p>All matches are case insensitive full string matches, except for 'status'
which matches exactly, and 'fpr' which matches case insensitively at the end of
the fingerprint.</p>

Romain Porte's avatar
Romain Porte committed
45
<p>For cn, mn, sn, email and uid, you can use <code>/value/</code> to match with a
46
case insensitive regular expression.</p>
Enrico Zini's avatar
Enrico Zini committed
47
48
49
50
51
52

<p>Results will only contain an 'email' field if the request is made by
authenticated people.</p>

<p>Example:</p>
<pre>
53
$ curl https://nm.debian.org/api/people?cn=/nric/
Enrico Zini's avatar
Enrico Zini committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
 "r": [
  {
   "status": "dd_u", 
   "uid": "gareuselesinge", 
   "created": "1136678400", 
   "url": "/public/person/gareuselesinge", 
   "mn": null, 
   "sn": "Tassi", 
   "fpr": "60D04388E3853643807B9507EE491C3E0123F2F2", 
   "status_changed": "1136678400", 
   "fullname": "Enrico Tassi", 
   "cn": "Enrico"
  }, 
  {
   "status": "dd_u", 
   "uid": "enrico", 
   "created": "1003968000", 
   "url": "/public/person/enrico", 
   "mn": null, 
   "sn": "Zini", 
   "fpr": "66B4DFB68CB24EBBD8650BC4F4B4B0CC797EBFAB", 
   "status_changed": "1003968000", 
   "fullname": "Enrico Zini", 
   "cn": "Enrico"
  }
 ]
}
</pre>
83

Enrico Zini's avatar
Enrico Zini committed
84
<h2>{% url 'api:status' %}</h2>
Enrico Zini's avatar
Enrico Zini committed
85
86
87
88
89

<p>Query the status of one, many or all people in the database</p>

<p>GET parameters can be used to control the results:</p>

90
<table class="table table-sm">
Enrico Zini's avatar
Enrico Zini committed
91
92
93
94
95
96
    <thead>
      <tr><th>Auth required</th><th>key</th><th>value</th></tr>
    </thead>
    <tbody>
    <tr><td>yes</td><td>status</td>
      <td>Get a list of all the people with the given status. You can use a
Romain Porte's avatar
Romain Porte committed
97
        comma-separated list of statuses, like <code>dd_nu,dd_u</code>.</td></tr>
Enrico Zini's avatar
Enrico Zini committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
    <tr><td>no</td><td>person</td>
      <td>Get the status of the person with the given SSO username. You can use
        a comma-separated list of SSO usernames.</td></tr>
    </tbody>
</table>

<p>If no parameter is specified, it returns a list of all known people. This
requires authentication.</p>

<p>Alternatively, you can POST a JSON list of SSO usernames, and get a reply
with the status of those people. This does not require authentication.</p>

<p>Example:</p>

<pre>
$ curl https://nm.debian.org/api/status --data '["enrico@debian.org","example-guest@users.alioth.debian.org"]'
{
 "people": {
  "enrico@debian.org": {
   "status": "dd_u", 
   "is_am": true
  },
  "example-guest@users.alioth.debian.org": {
   "status": "dm", 
  }
 }
}
</pre>


128
129
{% endblock %}