-
Notifications
You must be signed in to change notification settings - Fork 6
/
apiary.apib
400 lines (330 loc) · 12.9 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
FORMAT: 1A
HOST: http://demo.bitergia.com
# Grimoire API
API for accessing Grimoire entities and other data about a software
development project, or a collection of those.
Main abstractions of the API:
* **Entity**: Abstract item, that will have a unique name, and will
represent some property or measurement of the analyzed project,
with some specific semantics. An entity can be an specific
measurement (such as number of commits), but also other kinds of data
(such as developer name) or a structured combination of specific
measurements or other kinds of data (such as a time series of the
number of commits per month, or a list of developers).
* **Condition**. Qualifier that determine the context of an entity to
obtain a value. For example, the entity "number of commits" can be
qualified with the conditions "scope: all the project", "period:
from 2012-01-01 to 2012-12-31". Values are always of an entity
qualified by a set of conditions.
* **Value**. The specific value of an entity under speciic conditions.
For example, the number of commits of the OpenStack project for all
its life previous to 2014-01-08; the time series of the number of
commits per month for the months of Jan, Feb and March 2013 for
subproject XXX, or the list of the top ten developers with most
commits.
* **Family**. Mainly (collection) of entities that have some semantic
relationship, usually coming from the same or similar tables in the
database. For example, entities directly related to the source code
management system (SCM family), to the issue tracking system (ITS family),
or maybe to the demography studies (Demos family).
* **Set**. Set of entities that can be found together in the same
JSON document. They are defined for convenience, to avoid having to
specify in a single GET request a potentially large collection of
entities. This would be much more convenient for the static API,
for which in fact metrics are already grouped in JSON documents.
# Group Entities
Entities (and values for them) are provided as resources. In this
hierarchy, each leaf resource corresponds to an entity offered by
the API, and its value. Entities are structured in families, which
act as collections of entities. Each family, such as /ent/scm,
is a collection providing links to the available entities of that
family. Each entity, such as /ent/scm/commits provides
information about that entity, and the value of that entity.
## Collection of families of entities [/ents]
### List of all families of entities [GET]
Root of the hierarchy, acts as a collection of families of entities,
providing links to all families with available values.
+ Response 200 (application/json)
+ Body
{"items": [
{"href": "/ent/scm"},
{"href": "/ent/its"},
{"href": "/ent/mls"},
{"href": "/ent/wiki"},
{"href": "/ent/irc"}
],
"desc": "List of families of entities"
}
## Entities family [/ent/{fam}]
Collection of entities in a family
+ Parameters
+ fam (required, string, `scm`) ... Name of entities family.
+ Values
+ `scm`
+ `its`
+ `mls`
+ `wiki`
+ `irc`
### List all entities in the family [GET]
+ Response 200 (application/json)
+ Body
{"items": [
{"href": "/ent/scm/commits"},
{"href": "/ent/scm/authors"},
{"href": "/ent/scm/ts_commits"},
{"href": "/ent/scm/list_authors"}
]
"desc": "List of entities for the source code management family"
}
## SCM entities family [/ent/scm]
Collection of entities in the SCM family
### List all entities in the SCM family [GET]
+ Response 200 (application/json)
+ Body
{"items": [
{"href": "/ent/scm/commits"},
{"href": "/ent/scm/ncommits"},
{"href": "/ent/scm/tscommits"},
{"href": "/ent/scm/authors"},
{"href": "/ent/scm/nauthors"},
{"href": "/ent/scm/tsauthors"},
{"href": "/ent/scm/committers"},
{"href": "/ent/scm/ncommitters"},
{"href": "/ent/scm/tscommitters"},
{"href": "/ent/scm/branches"},
{"href": "/ent/scm/nbranches"},
{"href": "/ent/scm/tsbranches"},
{"href": "/ent/scm/nlines_add"},
{"href": "/ent/scm/tslines_add"},
{"href": "/ent/scm/nlines_rm"},
{"href": "/ent/scm/tslines_rm"},
{"href": "/ent/scm/nfiles"},
{"href": "/ent/scm/tsfiles"},
{"href": "/ent/scm/nrepos"},
{"href": "/ent/scm/tsrepos"}
]
"desc": "List of entities for the source code management family"
}
## Entity [/ent/{fam}/{entity}]
+ Parameters
+ fam (required, string, `scm`) ... Name of entity family
+ entity (required, string, `commits`) ... Name of entity
### Values for a given entity [GET]
General structure for all resources providing value and context
data for an entity. List of actual resources for entities follow
below.
+ Response 200 (application/json)
{"id": "scm/ts_commits",
"type": "ts of commits",
"desc": "Time serie of number of commits"
"value": {
"period": weeks,
"first_date": "2013-12-25",
"last_date": "2014-01-15",
"values": [23, 23, 56, 34],
"period_id": ["Dec 25 2013", "Jan 1 2014", "Jan 8 2014", "Jan 15 2014"]
}
}
## Number of commits [/ent/scm/ncommits]
### Number of commits in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/ncommits",
"type": "int",
"desc": "Number of commits in SCM repositories",
"value": 2245
}
## Timeserie of commits [/ent/scm/tscommits]
### Timeserie of commits in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/ts_commits",
"type": "ts of int",
"desc": "Time serie of number of commits in SCM repo(s)",
"value": {
"period": "weeks",
"first_date": "2013-12-25",
"last_date": "2014-01-15",
"values": [23, 23, 56, 34],
"period_id": ["Dec 25 2013", "Jan 1 2014", "Jan 8 2014", "Jan 15 2014"]
}
}
## List of commits [/ent/scm/commits]
### List of commits in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/commits",
"type": "list of commit",
"desc": "List of commits in SCM repositories",
"value": ["/ent/scm/commit/43", "/ent/scm/commit/47"]
}
## Commit record [/ent/scm/commits/{id}]
+ Parameters
+ id (required, `num`, 45) ... Commit number
### Information for a commit record in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/commits/45",
"scmid" = "fe23243edefdf4fedfeerrere",
"author" = 476,
"committer" = 45,
"date_author" = "2014-01-30T20:03:04",
"date_commit" = "2014-02-02T20:03:04",
"lines_add" = 345,
"lines_rem" = 254
}
## Number of authors [/ent/scm/nauthors]
### Number of authors in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/nauthors",
"type": "int",
"desc": "Number of authors in SCM repositories"
"value": { 207 }
}
## Number of branches [/ent/scm/nbranches]
### Number of active branches in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/nbranches",
"type": "int",
"desc": "Number of active branches in SCM repositories"
"value": { 15 }
}
## Number of files [/ent/scm/nfiles]
### Number of files changed by commits in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/nfiles",
"type": "int",
"desc": "Number of files changed by commits in SCM repositories"
"value": { 87 }
}
## Number of authors [/ent/scm/ncommitters]
### Number of authors in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/ncommitters",
"type": "int",
"desc": "Number of committers in SCM repositories"
"value": { 27 }
}
## Number of lines added [/ent/scm/nlines_add]
### Number of lines added in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/nlines_add",
"type": "int",
"desc": "Number of lines added in SCM repositories"
"value": { 13446 }
}
## Number of lines removed [/ent/scm/nlines_rm]
### Number of lines removed in SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/nlines_rm",
"type": "int",
"desc": "Number of lines removed in SCM repositories"
"value": { 20355 }
}
## Number of repositories [/ent/scm/nrepos]
### Number of active SCM repos [GET]
+ Response 200 (application/json)
{"id": "scm/nrepos",
"type": "int",
"desc": "Number of active SCM repo(s)"
"value": { 20355 }
}
# Group Sets
Standard sets of entities provided by the **Grimoire API**
Each set provides a set of entities, with the corresponding values. Sets
are useful for asking for (and obtaining) several entities at once.
Components of a set:
+ "id": unique name, which is the resource name after "/sets/"
+ "desc": description (text describing the set).
+ "templated": boolean describing whether the set name is templated.
Being templated means that the resource name includes one of more
strings which is in fact a template to be substituted by its value
before invocation. Those templates are condition names, such as
"org" for organizations.
+ "ents": list of entities, with values.
## Collection of sets [/sets]
### List all avaialble sets of entities [GET]
+ Response 200 (application/json)
{"sets": [
{"id": "scm/basic",
"href": "/sets/scm/basic",
"templated": false,
"desc": "Basic entities from source code management repositories"
"ents": [
{"id": "scm/ncommits"},
{"id": "scm/nauthors"},
{"id": "scm/ncommitters"},
{"id": "scm/ts_commits"},
{"id": "scm/ts_authors"},
{"id": "scm/ts_committers"}
]
},
{
"id": "{org/basic/{?org}}",
"href": "/sets/org/basic/{?org}",
"templated": true,
"parameters":
{"org":
{"name": "Organization",
"href": "/cond/scope/org"}}
"desc": "Basic entities for an organization (eg, a company)"
"ents": [
{"id": "scm/ncommits"},
{"id": "scm/nauthors"},
{"id": "scm/ncommitters"},
{"id": "scm/ts_commits"},
{"id": "scm/ts_authors"},
{"id": "scm/ts_committers"}
],
"cond": "scope=org/{?org}"
}
]
}
## Set providing basic SCM entities [/sets/scm/basic]
### Basic entities from SCM repositories [GET]
+ Response 200 (application/json)
{"id": "scm/basic",
"templated": false,
"desc": "Basic entities from source code management repositories"
"ents": [
{"common": true,
"type": int,
"ents": [
{"id": "scm/ncommits",
"desc": "Number of commits in SCM repositories"
"value": { 2245 }
},
{"id": "scm/nauthors",
"desc": "Number of authors in SCM repositories"
"value": { 207 }
},
{"id": "scm/ncommitters",
"desc": "Number of committers in SCM repositories"
"value": { 27 }
}]
},
{"common": true,
"type": "ts of int",
"value": {
"period": weeks,
"first_date": "2013-12-25",
"last_date": "2014-01-15",
"period_id": [`Dec 25 2013`, `Jan 1 2014`, `Jan 8 2014`, `Jan 15 2014`]
}
"ents": [
{"id": "scm/ts_commits",
"desc": "Time serie of number of commits in SCM repo(s)"
"value": {
"values": [23, 23, 56, 34],
}
},
{"id": "scm/ts_authors",
"desc": "Time serie of number of authors in SCM repo(s)"
"value": {
"values": [12, 9, 11, 13]
}
},
{"id": "scm/ts_committers"
"desc": "Time serie of number of committers in SCM repo(s)"
"value": {
"values": [10, 7, 6, 10]
}
}]
}]
}