diff --git a/api.rst b/api.rst index 7339f3dffc3666906b3f7c4699e1a79397aae3de..c82b59d95257d655cc4572eb4ba5a4560d8e9318 100644 --- a/api.rst +++ b/api.rst @@ -110,5 +110,63 @@ External client .. _`python client`: https://allgo.gitlabpages.inria.fr/api-clients/python_client/ +Get metrics +------------ +We provide a way to get simple metrics about *your* applications. +For the moment it allows to get for a given webapp, the number of job over a period of time. + +.. http:get:: /api/v1/metrics/(string: metric_type)/(int: webapp_id) + + We provide 3 metrics : + + - **per_user** : the number of jobs per time period and per user. + - **per_result** : the number of jobs per time period and per result. + - **created** : the number of jobs created per time period. + + + 3 parameters can refine your request : + + - **step** : string [*year,month,week,day*], the step of aggregation. + - **from** : date, the begin (including) of the time period to interrogate. + - **to** : date, the end (excluding) of the time period to interrogate. + + *Note: the dates should have the format "%Y-%m-%d", so 2019-04-01 for the first of april 2019.* + + .. mettre les valeurs par défaut ? + + :reqheader Authorization: Token token=<your_private_token> + + + .. http:example:: curl wget httpie python-requests + + GET /api/v1/metrics/per_user/151?from=2019-01-01&step=day HTTP/1.1 + Host: allgo18.inria.fr + Accept: application/json + Authorization: Token token=<your_private_token> + + **Example response**: + + .. sourcecode:: http + { + "GATB-Compiler": { + "from": "01-01-2017 00:00", + "to": "01-01-2018 00:00", + "data": [ + { + "time_period": "2017-01-01T00:00:00Z", + "user": 149, + "uname": "u149", + "n": 2499 + }, + { + "time_period": "2017-01-01T00:00:00Z", + "user": 35, + "uname": "u35", + "n": 22 + }, + ... + ] + } + }