]> arthur.barton.de Git - netdata.git/blob - web/netdata-swagger.yaml
Merge pull request #484 from ktsaou/master
[netdata.git] / web / netdata-swagger.yaml
1 swagger: '2.0'
2 info:
3   title: NetData API
4   description: 'Real time data collection and graphs...'
5   version: 1.2.1_master
6 host: netdata.firehol.org
7 schemes:
8   - http
9 basePath: /api/v1
10 produces:
11   - application/json
12 paths:
13   /charts:
14     get:
15       summary: 'Get a list of all charts available at the server'
16       description: 'The charts endpoint returns a summary about all charts stored in the netdata server.'
17       responses:
18         '200':
19           description: 'An array of charts'
20           schema:
21             type: array
22             items:
23               $ref: '#/definitions/chart_summary'
24   /chart:
25     get:
26       summary: 'Get info about a specific chart'
27       description: 'The Chart endpoint returns detailed information about a chart.'
28       parameters:
29         - name: chart
30           in: query
31           description: 'The id of the chart as returned by the /charts call.'
32           required: true
33           type: string
34           format: 'as returned by /charts'
35           default: 'system.cpu'
36       responses:
37         '200':
38           description: 'A javascript object with detailed information about the chart.'
39           schema:
40             $ref: '#/definitions/chart'
41         '404':
42           description: 'No chart with the given id is found.'
43   /data:
44     get:
45       summary: 'Get collected data for a specific chart'
46       description: |
47         The Data endpoint returns data stored in the round robin database of a chart.
48       parameters:
49         - name: chart
50           in: query
51           description: 'The id of the chart as returned by the /charts call.'
52           required: true
53           type: string
54           format: 'as returned by /charts'
55           allowEmptyValue: false
56           default: system.cpu
57         - name: dimension
58           in: query
59           description: 'zero, one or more dimension ids, as returned by the /chart call.'
60           required: false
61           type: array
62           items:
63             type: string
64             collectionFormat: pipes
65             format: 'as returned by /charts'
66           allowEmptyValue: false
67         - name: after
68           in: query
69           description: 'This parameter can either be an absolute timestamp specifying the starting point of the data to be returned, or a relative number of seconds, to the last collected timestamp. Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.'
70           required: true
71           type: number
72           format: integer
73           allowEmptyValue: false
74           default: -600
75         - name: before
76           in: query
77           description: 'This parameter can either be an absolute timestamp specifying the ending point of the data to be returned, or a relative number of seconds, to the last collected timestamp. Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.'
78           required: false
79           type: number
80           format: integer
81           default: 0
82         - name: points
83           in: query
84           description: 'The number of points to be returned. If not given, or it is <= 0, or it is bigger than the points stored in the round robin database for this chart for the given duration, all the available collected values for the given duration are returned.'
85           required: true
86           type: number
87           format: integer
88           allowEmptyValue: false
89           default: 20
90         - name: group
91           in: query
92           description: 'The grouping method. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. Two methods are supported, "max" and "average". "max" is actually calculated on the absolute value collected (so it works for both positive and negative dimesions to return the most extreme value in either direction).'
93           required: true
94           type: string
95           enum: [ 'max', 'average' ]
96           default: 'average'
97           allowEmptyValue: false
98         - name: format
99           in: query
100           description: 'The format of the data to be returned.'
101           required: true
102           type: string
103           enum: [ 'json', 'jsonp', 'csv', 'tsv', 'tsv-excel', 'ssv', 'ssvcomma', 'datatable', 'datasource', 'html', 'array', 'csvjsonarray' ]
104           default: json
105           allowEmptyValue: false
106         - name: options
107           in: query
108           description: 'Options that affect data generation.'
109           required: false
110           type: array
111           items:
112             type: string
113             enum: [ 'nonzero', 'flip', 'jsonwrap', 'min2max', 'seconds', 'milliseconds', 'abs', 'absolute', 'absolute-sum', 'null2zero', 'objectrows', 'google_json', 'percentage' ]
114             collectionFormat: pipes
115           default: [seconds, jsonwrap]
116           allowEmptyValue: false
117         - name: callback
118           in: query
119           description: 'For JSONP responses, the callback function name.'
120           required: false
121           type: string
122           allowEmptyValue: true
123         - name: filename
124           in: query
125           description: 'Add Content-Disposition: attachment; filename=<filename> header to the response, that will instruct the browser to save the response with the given filename.'
126           required: false
127           type: string
128           allowEmptyValue: true
129         - name: tqx
130           in: query
131           description: '[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.'
132           required: false
133           type: string
134           allowEmptyValue: true
135       responses:
136         '200':
137           description: 'The call was successful. The response should include the data.'
138           schema:
139             $ref: '#/definitions/chart'
140         '400':
141           description: 'Bad request - the body will include a message stating what is wrong.'
142         '404':
143           description: 'No chart with the given id is found.'
144         '500':
145           description: 'Internal server error. This usually means the server is out of memory.'
146   /badge.svg:
147     get:
148       summary: 'Generate a SVG image for a chart (or dimension)'
149       description: |
150         Successful responses are SVG images
151       parameters:
152         - name: chart
153           in: query
154           description: 'The id of the chart as returned by the /charts call.'
155           required: true
156           type: string
157           format: 'as returned by /charts'
158           allowEmptyValue: false
159           default: system.cpu
160         - name: dimension
161           in: query
162           description: 'zero, one or more dimension ids, as returned by the /chart call.'
163           required: false
164           type: array
165           items:
166             type: string
167             collectionFormat: pipes
168             format: 'as returned by /charts'
169           allowEmptyValue: false
170         - name: after
171           in: query
172           description: 'This parameter can either be an absolute timestamp specifying the starting point of the data to be returned, or a relative number of seconds, to the last collected timestamp. Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.'
173           required: true
174           type: number
175           format: integer
176           allowEmptyValue: false
177           default: -600
178         - name: before
179           in: query
180           description: 'This parameter can either be an absolute timestamp specifying the ending point of the data to be returned, or a relative number of seconds, to the last collected timestamp. Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.'
181           required: false
182           type: number
183           format: integer
184           default: 0
185         - name: points
186           in: query
187           description: 'The number of points to be returned. If not given, or it is <= 0, or it is bigger than the points stored in the round robin database for this chart for the given duration, all the available collected values for the given duration are returned.'
188           required: true
189           type: number
190           format: integer
191           allowEmptyValue: false
192           default: 20
193         - name: group
194           in: query
195           description: 'The grouping method. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. Two methods are supported, "max" and "average". "max" is actually calculated on the absolute value collected (so it works for both positive and negative dimesions to return the most extreme value in either direction).'
196           required: true
197           type: string
198           enum: [ 'max', 'average' ]
199           default: 'average'
200           allowEmptyValue: false
201         - name: options
202           in: query
203           description: 'Options that affect data generation.'
204           required: false
205           type: array
206           items:
207             type: string
208             enum: [ 'nonzero', 'flip', 'abs', 'absolute', 'absolute-sum', 'null2zero', 'percentage' ]
209             collectionFormat: pipes
210           default: ['absolute']
211           allowEmptyValue: true
212         - name: label
213           in: query
214           description: 'a text to be used as the label'
215           required: false
216           type: string
217           format: 'any text'
218           allowEmptyValue: true
219         - name: units
220           in: query
221           description: 'a text to be used as the units'
222           required: false
223           type: string
224           format: 'any text'
225           allowEmptyValue: true
226         - name: label_color
227           in: query
228           description: 'a color to be used for the background of the label'
229           required: false
230           type: string
231           format: 'any text'
232           allowEmptyValue: true
233         - name: value_color
234           in: query
235           description: 'a color to be used for the background of the label. You can set multiple using a pipe with a condition each, like this: color<value|color>value|color:null The following operators are supported: >, <, >=, <=, =, :null (to check if no value exists).'
236           required: false
237           type: string
238           format: 'any text'
239           allowEmptyValue: true
240         - name: multiply
241           in: query
242           description: 'multiply the value with this number for rendering it at the image (integer value required)'
243           required: false
244           type: number
245           format: integer
246           allowEmptyValue: true
247         - name: divide
248           in: query
249           description: 'divide the value with this number for rendering it at the image (integer value required)'
250           required: false
251           type: number
252           format: integer
253           allowEmptyValue: true
254       responses:
255         '200':
256           description: 'The call was successful. The response should be an SVG image.'
257         '400':
258           description: 'Bad request - the body will include a message stating what is wrong.'
259         '404':
260           description: 'No chart with the given id is found.'
261         '500':
262           description: 'Internal server error. This usually means the server is out of memory.'
263 definitions:
264   chart_summary:
265     type: object
266     properties:
267       hostname:
268         type: string
269         description: 'The hostname of the netdata server.'
270       update_every:
271         type: number
272         description: 'The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this.'
273       charts:
274         type: object
275         description: 'An object containing all the chart objects available at the netdata server. This is used as an indexed array. The key of each chart object is the id of the chart.'
276         properties:
277           key:
278               $ref: '#/definitions/chart'
279   chart:
280     type: object
281     properties:
282       id:
283         type: string
284         description: 'The unique id of the chart'
285       name:
286         type: string
287         description: 'The name of the chart'
288       type:
289         type: string
290         description: 'The type of the chart. Types are not handled by netdata. You can use this field for anything you like.'
291       family:
292         type: string
293         description: 'The family of the chart. Families are not handled by netdata. You can use this field for anything you like.'
294       title:
295         type: string
296         description: 'The title of the chart.'
297       priority:
298         type: string
299         description: 'The relative priority of the chart. NetData does not care about priorities. This is just an indication of importance for the chart viewers to sort charts of higher priority (lower number) closer to the top. Priority sorting should only be used among charts of the same type or family.'
300       enabled:
301         type: boolean
302         description: 'True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available.'
303       units:
304         type: string
305         description: 'The unit of measurement for the values of all dimensions of the chart.'
306       data_url:
307         type: string
308         description: 'The absolute path to get data values for this chart. You are expected to use this path as the base when constructing the URL to fetch data values for this chart.'
309       chart_type:
310         type: string
311         description: 'The chart type.'
312         enum: [ 'line', 'area', 'stacked' ]
313       duration:
314         type: number
315         description: 'The duration, in seconds, of the round robin database maintained by netdata.'
316       first_entry:
317         type: number
318         description: 'The UNIX timestamp of the first entry (the oldest) in the round robin database.'
319       last_entry:
320         type: number
321         description: 'The UNIX timestamp of the latest entry in the round robin database.'
322       update_every:
323         type: number
324         description: 'The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database.'
325       dimensions:
326         type: object
327         description: 'An object containing all the chart dimensions available for the chart. This is used as an indexed array. The key of the object the id of the dimension.'
328         properties:
329           key:
330               $ref: '#/definitions/dimension'
331   dimension:
332     type: object
333     properties:
334       name:
335         type: string
336         description: 'The name of the dimension'
337  
338   json_wrap:
339     type: object
340     properties:
341       api:
342         type: number
343         description: 'The API version this conforms to, currently 1'
344       id:
345         type: string
346         description: 'The unique id of the chart'
347       name:
348         type: string
349         description: 'The name of the chart'
350       update_every:
351         type: number
352         description: 'The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database (indepedently of the current view).'
353       view_update_every:
354         type: number
355         description: 'The current view appropriate update frequency of this chart, in seconds. There is no point to request chart refreshes, using the same settings, more frequently than this.'
356       first_entry:
357         type: number
358         description: 'The UNIX timestamp of the first entry (the oldest) in the round robin database (indepedently of the current view).'
359       last_entry:
360         type: number
361         description: 'The UNIX timestamp of the latest entry in the round robin database (indepedently of the current view).'
362       after:
363         type: number
364         description: 'The UNIX timestamp of the first entry (the oldest) returned in this response.'
365       before:
366         type: number
367         description: 'The UNIX timestamp of the latest entry returned in this response.'
368       min:
369         type: number
370         description: 'The minimum value returned in the current view. This can be used to size the y-series of the chart.'
371       max:
372         type: number
373         description: 'The maximum value returned in the current view. This can be used to size the y-series of the chart.'
374       dimension_names:
375         description: 'The dimension names of the chart as returned in the current view.'
376         type: array
377         items:
378           type: string
379       dimension_ids:
380         description: 'The dimension IDs of the chart as returned in the current view.'
381         type: array
382         items:
383           type: string
384       latest_values:
385         description: 'The latest values collected for the chart (indepedently of the current view).'
386         type: array
387         items:
388           type: string
389       view_latest_values:
390         description: 'The latest values returned with this response.'
391         type: array
392         items:
393           type: string
394       dimensions:
395         type: number
396         description: 'The number of dimensions returned.'
397       points:
398         type: number
399         description: 'The number of rows / points returned.'
400       format:
401         type: string
402         description: 'The format of the result returned.'
403       result:
404         description: 'The result requested, in the format requested.'