You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: source/v1/index.html.md
+72-2Lines changed: 72 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,71 @@ All JSON responses from the API is wrapped in a base object.
136
136
137
137
Be sure to include an `Accept: application/json` header, otherwise errors like `401`, `403` & `404` will either return HTML or redirect you to the login page.
138
138
139
+
## Headers
140
+
141
+
### Exposed Headers
142
+
143
+
-`Content-Type`(`application/json` or the filetype, e.g. `image/png`)
144
+
-`Content-Disposition` (only for files, defaults to `attachment; filename="filename.ext"`)
All returned model resources have an `ETag` and `Last-Modified` header.
171
+
172
+
`ETag` are returned from get, create & update requests.
173
+
Because the ETags are weak they can be used on other routes as well.
174
+
175
+
For example, when creating a new resource, the API will return an `ETag`,
176
+
this `ETag` can be used on the get route to check if the resource has been modified since creating it.
177
+
178
+
### We Also Expose CORS Headers
179
+
180
+
-`Access-Control-Allow-Origin` (default `*`)
181
+
-`Access-Control-Allow-Methods`
182
+
-`Access-Control-Allow-Headers`
183
+
-`Access-Control-Expose-Headers`
184
+
-`Access-Control-Max-Age`
185
+
186
+
### Accepted Headers
187
+
188
+
-`Authorization`
189
+
-`Accept`
190
+
-`Content-Type`
191
+
192
+
### For Pagination
193
+
See [pagination](#pagination)
194
+
195
+
-`X-Page`
196
+
-`X-Per-Page`
197
+
-`X-Offset`
198
+
199
+
### For HTTP Caching
200
+
201
+
-`If-Match`
202
+
-`If-Modified-Since`
203
+
139
204
## Query Parameters
140
205
141
206
The API has a few query parameters available that you can use to help find the resources you need.
@@ -147,21 +212,26 @@ All three of these query parameters are only available on listing endpoints, so
147
212
> As Query Parameter
148
213
149
214
```
150
-
?page=1&per_page=50
215
+
?page=1&per_page=50&offset=0
151
216
```
152
217
153
218
> As Header
154
219
155
220
```
156
221
X-Page: 1
157
222
X-Per-Page: 50
223
+
X-Offset: 0
158
224
```
159
225
160
226
By default the API returns 12 items per page and defaults to page 1.
161
227
162
228
The number of items per page can be increased to a maximum of 50 items.
163
229
164
-
<br/><br/><br/><br/><br/><br/>
230
+
### Offset
231
+
232
+
`offset` is a special parameter within our pagination system, the `offset` will remove the first `n` items from the list you are querying. `offset` can be used to work around getting duplicate data.
233
+
234
+
So, for example: if the list has 600 items and the `offset` is set to 100, the `X-Paginate-Total` will report 500 items, other headers like `X-Paginate-Pages` will also be calculated from the new total.
0 commit comments