-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmetrics_swagger.yaml
More file actions
179 lines (179 loc) · 4.96 KB
/
Copy pathmetrics_swagger.yaml
File metadata and controls
179 lines (179 loc) · 4.96 KB
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
openapi: 3.0.3
info:
title: data.gouv.fr Metrics API
description: |
Access data.gouv.fr metrics (number of downloads and/or visits per resource, organization, site, etc) as JSON or CSV.
Supports pagination and filtering. Use query params like `column__exact=value`,
`column__sort=asc`, `page` and `page_size`.
version: 1.0.0
tags:
- name: Metrics data retrieval
description: Retrieve metrics data
- name: Health
description: Service health
paths:
/api/{model}/data/:
get:
tags:
- Metrics data retrieval
description: Returns paginated metrics for the given model. Filter with `column__exact=value`, sort with `column__sort=asc` or `column__sort=desc`.
summary: Get metrics by model (JSON)
operationId: getMetricsByModel
responses:
'200':
description: successful operation (body has data, links.next/prev, meta.page/page_size/total)
content:
application/json:
schema:
type: object
properties:
data:
type: array
items: {}
links:
type: object
meta:
type: object
'400':
description: Invalid query string
'404':
description: Model not found
parameters:
- name: model
in: path
description: Metrics table name (e.g. site, organization, dataset)
required: true
schema:
type: string
example: site
- name: page
in: query
required: false
description: Page number (1-based)
schema:
type: integer
default: 1
- name: page_size
in: query
required: false
description: Number of results per page
schema:
type: integer
- name: column__sort
in: query
required: false
description: Sort by column (column__sort=asc or column__sort=desc)
schema:
type: string
enum: [asc, desc]
- name: column__exact
in: query
required: false
description: Exact match on column (column__exact=value)
schema:
type: string
- name: column__contains
in: query
required: false
description: Substring match (column__contains=value)
schema:
type: string
- name: column__less
in: query
required: false
description: Less than (column__less=value)
schema:
type: string
- name: column__greater
in: query
required: false
description: Greater than (column__greater=value)
schema:
type: string
/api/{model}/data/csv/:
get:
tags:
- Metrics data retrieval
description: Returns CSV for the model. Filter/sort params (column__exact, column__sort, etc.) apply; pagination is not applied (full result set is streamed).
summary: Get metrics by model (CSV)
operationId: getMetricsByModelCSV
responses:
'200':
description: successful operation
content:
text/csv: {}
'400':
description: Invalid query string
'404':
description: Model not found
parameters:
- name: model
in: path
description: Metrics table name (e.g. site, organization, dataset)
required: true
schema:
type: string
example: site
- name: column__sort
in: query
required: false
description: Sort by column (column__sort=asc or column__sort=desc)
schema:
type: string
enum: [asc, desc]
- name: column__exact
in: query
required: false
description: Exact match (column__exact=value)
schema:
type: string
- name: column__contains
in: query
required: false
description: Substring match (column__contains=value)
schema:
type: string
- name: column__less
in: query
required: false
description: Less than (column__less=value)
schema:
type: string
- name: column__greater
in: query
required: false
description: Greater than (column__greater=value)
schema:
type: string
/health/:
get:
tags:
- Health
description: Service health check (status, version, uptime).
summary: Health check
operationId: getHealth
responses:
'200':
description: Service is healthy
content:
application/json:
schema:
$ref: '#/components/schemas/Health'
'503':
description: Database unavailable
components:
schemas:
Health:
description: Health check response
type: object
properties:
status:
type: string
example: ok
version:
type: string
description: Deployed app version
uptime_since:
type: string
format: date-time
description: ISO 8601 datetime of app startup