Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 1f9b162

Browse files
committed
Add offset/limit pagination for indexes and API keys
1 parent 4c365d6 commit 1f9b162

File tree

3 files changed

+129
-6
lines changed

3 files changed

+129
-6
lines changed

text/0085-api-keys.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,67 @@ Only the master key allows managing the API keys.
368368
```
369369
"Authorization: Bearer :masterKey"
370370
```
371+
##### Query Parameters
371372

372-
##### Response
373+
| Field | Type | Required |
374+
|--------------------------|--------------------------|----------|
375+
| `offset` | Integer / `null` | false |
376+
| `limit` | Integer / `null` | false |
377+
378+
###### `offset`
379+
380+
- Type: Integer
381+
- Required: False
382+
- Default: `0`
383+
384+
Sets the starting point in the results, effectively skipping over a given number of API keys.
385+
386+
###### `limit`
387+
388+
- Type: Integer
389+
- Required: False
390+
- Default: `20`
391+
392+
Sets the maximum number of documents to be returned by the current request.
393+
394+
##### Response Definition
395+
396+
| Field | Type | Required |
397+
|--------------------------|--------------------------|----------|
398+
| `result` | Array[Key] | true |
399+
| `offset` | Integer | true |
400+
| `limit` | Integer | true |
401+
| `total` | Integer | true |
402+
403+
###### `results`
404+
405+
- Type: Array[Key]
406+
- Required: True
407+
408+
An array containing the fetched API keys.
409+
410+
###### `offset`
411+
412+
- Type: Integer
413+
- Required: True
414+
415+
Gives the `offset` parameter used for the query.
416+
417+
###### `limit`
418+
419+
- Type: Integer
420+
- Required: True
421+
422+
Gives the `limit` parameter used for the query.
423+
424+
###### `total`
425+
426+
- Type: Integer
427+
- Required: True
428+
429+
Gives the total number of API keys that can be browsed.
430+
431+
###### Example
373432

374433
`200 Success`
375434

@@ -417,7 +476,10 @@ Only the master key allows managing the API keys.
417476
"createdAt": "2021-08-11T10:00:00Z",
418477
"updatedAt": "2021-08-11T10:00:00Z"
419478
}
420-
]
479+
],
480+
"offset": 0,
481+
"limit": 20,
482+
"total": 3
421483
}
422484
```
423485

text/0124-documents-api.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Unique identifier of an index.
5353
| Field | Type | Required |
5454
|--------------------------|--------------------------|----------|
5555
| `offset` | Integer / `null` | false |
56-
| `limit` | String / `null` | false |
56+
| `limit` | Integer / `null` | false |
5757
| `attributesToRetrieve` | String / `null` | false |
5858

5959
###### 3.1.1.2.1. `offset`
@@ -95,6 +95,7 @@ A `results` array representing documents as JSON objects.
9595
| `results` | Array[Document] | true |
9696
| `offset` | Integer | true |
9797
| `limit` | Integer | true |
98+
| `total` | Integer | true |
9899

99100
###### 3.1.1.3.1. `results`
100101

@@ -121,6 +122,12 @@ Gives the `limit` parameter used for the query.
121122

122123
> See [3.1.1.2.2. `limit`](#31122-limit) section.
123124
125+
###### 3.1.1.3.3. `total`
126+
127+
- Type: Integer
128+
- Required: True
129+
130+
Gives the total number of documents that can be browsed in the related index.
124131

125132
###### 3.1.1.3.4. Example
126133

@@ -137,7 +144,8 @@ Gives the `limit` parameter used for the query.
137144
}
138145
],
139146
"offset": 0,
140-
"limit": 2
147+
"limit": 2,
148+
"total": 3 //The index contains 3 documents in total
141149
}
142150
```
143151

text/0132-indexes-api.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,74 @@ Manipulate indexes of a Meilisearch instance.
9696

9797
List all indexes of a Meilisearch instance.
9898

99-
##### 3.2.1.1. Response Definition
99+
The results are sorted in ascending alphanumeric order from the `uid` field.
100+
101+
##### 3.2.1.1. Query Parameters
102+
103+
| Field | Type | Required |
104+
|--------------------------|--------------------------|----------|
105+
| `offset` | integer / `null` | false |
106+
| `limit` | integer / `null` | false |
107+
108+
###### 3.2.1.1.1. `offset`
109+
110+
- Type: Integer
111+
- Required: False
112+
- Default: `0`
113+
114+
Sets the starting point in the results, effectively skipping over a given number of indexes.
115+
116+
###### 3.2.1.1.2. `limit`
117+
118+
- Type: Integer
119+
- Required: False
120+
- Default: `20`
121+
122+
Sets the maximum number of indexes to be returned by the current request.
123+
124+
##### 3.2.1.2. Response Definition
100125

101126
An object containing all the indexes.
102127

103128
| Field | Type | Required |
104129
|--------------------------|--------------------------|----------|
105130
| `results` | Array[Index] | true |
131+
| `offset` | integer | true |
132+
| `limit` | integer | true |
133+
| `total` | integer | true |
106134

107-
###### 3.2.1.1.1. `results`
135+
###### 3.2.1.2.1. `results`
108136

109137
- Type: Array[Index]
110138
- Required: True
111139

112140
An array containing the fetched indexes.
113141

142+
###### 3.2.1.2.2. `offset`
143+
144+
- Type: Integer
145+
- Required: True
146+
147+
Gives the `offset` parameter used for the query.
148+
149+
> See [3.2.1.1.1. `offset`](#32111-offset) section.
150+
151+
###### 3.2.1.2.3. `limit`
152+
153+
- Type: Integer
154+
- Required: True
155+
156+
Gives the `limit` parameter used for the query.
157+
158+
> See [3.2.1.1.2. `limit`](#32112-limit) section.
159+
160+
###### 3.2.1.2.3. `total`
161+
162+
- Type: Integer
163+
- Required: True
164+
165+
Gives the total number of indexes that can be browsed.
166+
114167
#### 3.2.2. `GET` - `indexes/:index_uid`
115168

116169
Fetch an index of a Meilisearch instance.

0 commit comments

Comments
 (0)