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

Commit 777b47b

Browse files
committed
Introduces HTTP Verbs changesto be compliant regarding a Rest API
1 parent c2d7d9e commit 777b47b

12 files changed

+38
-48
lines changed

open-api.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,10 +1159,10 @@ paths:
11591159
$ref: '#/components/responses/401'
11601160
'404':
11611161
description: Not Found
1162-
put:
1162+
patch:
11631163
operationId: indexes.update
11641164
summary: Update Index
1165-
description: Update an index. Add a primaryKey if it doesn't already exists yet.
1165+
description: Update an index. Specify a primaryKey if it doesn't already exists yet.
11661166
tags:
11671167
- Indexes
11681168
security:
@@ -1788,7 +1788,7 @@ paths:
17881788
$ref: '#/components/responses/401'
17891789
'404':
17901790
description: Not Found
1791-
post:
1791+
patch:
17921792
operationId: indexes.settings.update
17931793
summary: Update settings
17941794
description: |
@@ -1925,7 +1925,7 @@ paths:
19251925
$ref: '#/components/responses/401'
19261926
'404':
19271927
description: Not Found
1928-
post:
1928+
put:
19291929
operationId: indexes.settings.synonyms.update
19301930
summary: Update synonyms
19311931
description: |
@@ -1993,7 +1993,7 @@ paths:
19931993
$ref: '#/components/responses/401'
19941994
'404':
19951995
description: Not Found
1996-
post:
1996+
put:
19971997
operationId: indexes.settings.sortable-attributes.update
19981998
summary: Update sortable attributes
19991999
description: |
@@ -2068,7 +2068,7 @@ paths:
20682068
$ref: '#/components/responses/401'
20692069
'404':
20702070
description: Not Found
2071-
post:
2071+
put:
20722072
operationId: indexes.settings.stopWords.update
20732073
summary: Update stop-words
20742074
description: |
@@ -2136,7 +2136,7 @@ paths:
21362136
$ref: '#/components/responses/401'
21372137
'404':
21382138
description: Not Found
2139-
post:
2139+
put:
21402140
operationId: indexes.settings.rankingRules.update
21412141
summary: Update ranking rules
21422142
description: |
@@ -2214,7 +2214,7 @@ paths:
22142214
$ref: '#/components/responses/401'
22152215
'404':
22162216
description: Not Found
2217-
post:
2217+
patch:
22182218
operationId: indexes.settings.typoTolerance.update
22192219
summary: Update typo tolerance settings
22202220
description: |
@@ -2282,7 +2282,7 @@ paths:
22822282
$ref: '#/components/responses/401'
22832283
'404':
22842284
description: Not Found
2285-
post:
2285+
put:
22862286
operationId: indexes.settings.filterableAttributes.update
22872287
summary: Update Filterable Attributes
22882288
description: |
@@ -2351,7 +2351,7 @@ paths:
23512351
$ref: '#/components/responses/401'
23522352
'404':
23532353
description: Not Found
2354-
post:
2354+
put:
23552355
operationId: indexes.settings.distinctAttribute.update
23562356
summary: Update distinct attribute
23572357
description: |
@@ -2418,7 +2418,7 @@ paths:
24182418
$ref: '#/components/responses/401'
24192419
'404':
24202420
description: Not Found
2421-
post:
2421+
put:
24222422
operationId: indexes.settings.searchableAttributes.update
24232423
summary: Update searchable attributes
24242424
description: |
@@ -2484,7 +2484,7 @@ paths:
24842484
$ref: '#/components/responses/401'
24852485
'404':
24862486
description: Not Found
2487-
post:
2487+
put:
24882488
operationId: indexes.settings.displayedAttributes.update
24892489
summary: Update displayed attributes
24902490
description: |

text/0117-typo-tolerance-setting-api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ All properties must be returned when the resource is retrieved.
176176

177177
- 🔴 If the index does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
178178

179-
#### 3.2.2.2. `POST` - `indexes/:index_uid/settings/typo-tolerance`
179+
#### 3.2.2.2. `PATCH` - `indexes/:index_uid/settings/typo-tolerance`
180180

181181
Allow customizing partially the settings of the typo tolerance feature for an index.
182182

@@ -292,5 +292,4 @@ The `typo` ranking rule favors candidates with the least typos. That is, if a do
292292
- Expose `typoTolerance` resource as a search parameter to override index settings.
293293
- Add the possibility to disable the typo tolerance feature on all numeric fields.
294294
- Add different modes of result matching for the typo feature. e.g. `default`/`min`/`strict`
295-
- Replace `POST` to `PATCH` verb to allow partial edit of the settings and embrace REST API convention.
296295
- Introduce synchronous `invalid_typo_tolerance_{fieldName}` error with a better error message than the one provided by serde.

text/0123-displayed-attributes-setting-api.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Therefore, if a document field is not in the `displayedAttributes` list, the fie
2323

2424
Suppose a database of movies with the following fields: `id`, `overview`, `genres`, `title`, `release_date`. Some of these fields are more useful to be displayed than others. To make the `id` and `genres` fields non-displayed, it can be specified in the following way.
2525

26-
***Request payload `POST`- `/indexes/movies/settings/displayed-attributes`***
26+
***Request payload `PUT`- `/indexes/movies/settings/displayed-attributes`***
2727
```json
2828
["title", "overview"]
2929
```
@@ -51,7 +51,7 @@ Fetch the `displayedAttributes` setting of a Meilisearch index.
5151

5252
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
5353

54-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/displayed-attributes`
54+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/displayed-attributes`
5555

5656
Modify the `displayedAttributes` setting of a Meilisearch index.
5757

@@ -122,6 +122,5 @@ N/A
122122

123123
## 5. Future Possibilities
124124

125-
- Replace `POST` HTTP verb with `PATCH`
126125
- Add dedicated error to avoid using generic `bad_request` error code
127126
- Return an error when `displayedAttributes` is defined as an empty array

text/0123-distinct-attribute-setting-api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Fetch the `distinctAttribute` setting of a Meilisearch index.
9595

9696
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
9797

98-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/distinct-attribute`
98+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/distinct-attribute`
9999

100100
Modify the `distinctAttribute` setting of a Meilisearch index.
101101

@@ -169,6 +169,5 @@ Modifying this index setting cause documents to be re-indexed.
169169

170170
## 5. Future Possibilities
171171

172-
- Replace `POST` HTTP verb with `PATCH`
173172
- Add dedicated error to avoid using generic `bad_request` error code
174173
- Return an error when `distinctAttribute` is specified as an empty string

text/0123-filterable-attributes-setting-api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Fetch the `filterableAttributes` setting of a Meilisearch index.
4242

4343
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
4444

45-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/filterable-attributes`
45+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/filterable-attributes`
4646

4747
Modify the `filterableAttributes` setting of a Meilisearch index.
4848

@@ -116,5 +116,4 @@ Modifying this index setting cause documents to be re-indexed.
116116

117117
## 5. Future Possibilities
118118

119-
- Replace `POST` HTTP verb with `PATCH`
120119
- Add dedicated error to avoid using generic `bad_request` error code

text/0123-ranking-rules-setting-api.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Suppose a movie dataset. The documents contain a field `release_date` with a tim
8888

8989
The following example creates a custom ranking rule that makes recent movies more relevant than older ones. A movie released in 2020 will appear before a movie released in 1999.
9090

91-
***Request payload `POST`- `/indexes/products/settings/ranking-rules`***
91+
***Request payload `PUT`- `/indexes/products/settings/ranking-rules`***
9292
```json
9393
[
9494
"words",
@@ -123,7 +123,7 @@ Fetch the `rankingRules` setting of a Meilisearch index.
123123

124124
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
125125

126-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/ranking-rules`
126+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/ranking-rules`
127127

128128
Modify the `rankingRules` setting of a Meilisearch index.
129129

@@ -201,6 +201,5 @@ The first ranking rule is applied to all documents, while each subsequent rule i
201201

202202
## 5. Future Possibilities
203203

204-
- Replace `POST` HTTP verb with `PATCH`
205204
- Add dedicated error to avoid using generic `bad_request` error code
206205
- Return an error when `rankingRules` is defined as an empty array

text/0123-searchable-attributes-setting-api.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ By default, Meilisearch looks for matches in every field, but the `searchableAtt
2121

2222
Suppose a database of movies with the following fields: `id`, `overview`, `genres`, `title`, `release_date`. These fields all contain useful information; however, some are more useful to search than others. To make the `id` and `release_date` fields non-searchable and re-order the remaining fields by importance, it can be specified in the following way.
2323

24-
***Request payload `POST`- `/indexes/movies/settings/searchable-attributes`***
24+
***Request payload `PUT`- `/indexes/movies/settings/searchable-attributes`***
2525
```json
2626
["overview", "genres", "title"]
2727
```
@@ -49,7 +49,7 @@ This default behavior is indicated by a `searchableAttributes` value of `["*"]`.
4949

5050
To make some attributes non-searchable, or change the attribute ranking order. Attributes must be described from most important to least important.
5151

52-
***Request payload `POST`- `/indexes/movies/settings/searchable-attributes`***
52+
***Request payload `PUT`- `/indexes/movies/settings/searchable-attributes`***
5353
```json
5454
["title", "overview", "genres"]
5555
```
@@ -64,12 +64,11 @@ Manually updating `searchableAttributes` will change the displayed order of docu
6464

6565
A document field that is not defined in the list of `searchableAttributes` will not be considered by the following ranking rules to match and rank search results.
6666

67-
- [Words]()
68-
- [Typo]()
69-
- [Proximity]()
70-
- [Attribute]()
71-
- [Exactness](0036-exactness-criterion.md)
72-
67+
1. [Words](0123-settings-api.md#3111-words-ranking-rule)
68+
2. [Typo](0123-settings-api.md#3112-typo-ranking-rule)
69+
3. [Proximity](0123-settings-api.md#3113-proximity-ranking-rule)
70+
4. [Attribute](0123-settings-api.md#3114-attribute-ranking-rule)
71+
6. [Exactness](0123-settings-api.md#3116-exactness-ranking-rule)
7372

7473
### 3.2. Global Settings API Endpoints Definition
7574

@@ -94,7 +93,7 @@ Fetch the `searchableAttributes` setting of a Meilisearch index.
9493

9594
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
9695

97-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/searchable-attributes`
96+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/searchable-attributes`
9897

9998
Modify the `searchableAttributes` setting of a Meilisearch index.
10099

@@ -170,7 +169,6 @@ Modifying this index setting cause documents to be re-indexed.
170169

171170
## 5. Future Possibilities
172171

173-
- Replace `POST` HTTP verb with `PATCH`
174172
- Add dedicated error to avoid using generic `bad_request` error code
175173
- Return an error when `searchableAttributes` is defined as an empty array
176174
- Fix the reordering issue of document representation when `searchableAttributes` is specified.

text/0123-settings-api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ N/A
2121
| [stop-words](0123-stop-words-setting-api.md) | `stopWords` sub-resource API endpoints definition |
2222
| [synonyms](0123-synonyms-setting-api.md) | `synonyms` sub-resource API endpoints definition |
2323
| [distinct-attribute](0123-distinct-attribute-setting-api.md) | `distinctAttribute` sub-resource API endpoints definition |
24-
| [typo-tolerance](0117-typo-tolerance-setting-api.md) | `typoTolerance` sub-resource API endpoints definition |
24+
| [typo-tolerance](0117-typo-tolerance-setting-api.md) | `typoTolerance` sub-resource API endpoints definition |
2525

2626
Each setting is exposed as a sub-resource of the `indexes/:index_uid/settings` endpoints. e.g. The ranking rules setting of a Meilisearch index is exposed at `indexes/:index_uid/settings/ranking-rules`.
2727

@@ -55,7 +55,7 @@ The attributes ordering in the response payload is equivalent to the order descr
5555

5656
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
5757

58-
#### 3.2.2. `POST` - `indexes/:index_uid/settings`
58+
#### 3.2.2. `PATCH` - `indexes/:index_uid/settings`
5959

6060
Modify the settings of a Meilisearch index.
6161

@@ -148,4 +148,4 @@ Changing any of the following index settings will cause documents to be re-index
148148

149149
## 5. Future Possibilities
150150

151-
- Replace `POST` HTTP verb with `PATCH`
151+
n/a

text/0123-sortable-attributes-setting-api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Fetch the `sortableAttributes` setting of a Meilisearch index.
4242

4343
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
4444

45-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/sortable-attributes`
45+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/sortable-attributes`
4646

4747
Modify the `sortableAttributes` setting of a Meilisearch index.
4848

@@ -116,5 +116,4 @@ Modifying this index setting cause documents to be re-indexed.
116116

117117
## 5. Future Possibilities
118118

119-
- Replace `POST` HTTP verb with `PATCH`
120119
- Add dedicated error to avoid using generic `bad_request` error code

text/0123-stop-words-setting-api.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The `stopWords` index setting allows the configuration of a list of words to be
1717

1818
Suppose a database contains articles written in English. Countless occurrences of `the` and `of` could deteriorate the relevancy of search results. To set `the` and `of` words as stop words, it can be specified the following way.
1919

20-
***Request payload `POST`- `/indexes/articles/settings/stop-words`***
20+
***Request payload `PUT`- `/indexes/articles/settings/stop-words`***
2121
```json
2222
["the", "of"]
2323
```
@@ -47,7 +47,7 @@ Fetch the `stopWords` setting of a Meilisearch index.
4747

4848
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
4949

50-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/stop-words`
50+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/stop-words`
5151

5252
Modify the `stopWords` setting of a Meilisearch index.
5353

@@ -119,5 +119,4 @@ Modifying this index setting cause documents to be re-indexed.
119119

120120
## 5. Future Possibilities
121121

122-
- Replace `POST` HTTP verb with `PATCH`
123122
- Add dedicated error to avoid using generic `bad_request` error code

text/0123-synonyms-setting-api.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Meilisearch supports two types of synonym declarations.
2626

2727
One-way association permits to declare one word to be synonymous with another, but not the other way around.
2828

29-
***Request payload `POST`- `/indexes/proucts/settings/synonyms`***
29+
***Request payload `PUT`- `/indexes/proucts/settings/synonyms`***
3030
```json
3131
{
3232
"phone": [
@@ -43,7 +43,7 @@ However, in the case of a search for `iphone`, documents containing `phone` will
4343

4444
By associating one or more synonyms with each other, they will be considered the same in both directions.
4545

46-
***Request payload `POST`- `/indexes/proucts/settings/synonyms`***
46+
***Request payload `PUT`- `/indexes/proucts/settings/synonyms`***
4747
```json
4848
{
4949
"shoe": [
@@ -94,7 +94,7 @@ Fetch the `synonyms` setting of a Meilisearch index.
9494

9595
- 🔴 If the requested `index_uid` does not exist, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error.
9696

97-
#### 3.3.2. `POST` - `indexes/:index_uid/settings/synonyms`
97+
#### 3.3.2. `PUT` - `indexes/:index_uid/settings/synonyms`
9898

9999
Modify the `synonyms` setting of a Meilisearch index.
100100

@@ -213,6 +213,5 @@ For example, although `League of Legends` and `LOL` can be synonymous, it will n
213213

214214
## 5. Future Possibilities
215215

216-
- Replace `POST` HTTP verb with `PATCH`
217216
- Add dedicated error to avoid using generic `bad_request` error code
218217
- Automatically declare mutual association

text/0132-indexes-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Manipulate indexes of a Meilisearch instance.
8080
- [3.2.1. `GET` - `indexes`](#321-get---indexes)
8181
- [3.2.2. `GET` - `indexes/:index_uid`](#322-get---indexesindexuid)
8282
- [3.2.3. `POST` - `indexes`](#323-post---indexes)
83-
- [3.2.4. `PUT` - `indexes/:index_uid`](#324-put---indexesindexuid)
83+
- [3.2.4. `PATCH` - `indexes/:index_uid`](#324-patch---indexesindexuid)
8484
- [3.2.5. `DELETE` - `indexes/:index_uid`](#325-delete---indexesindexuid)
8585

8686
#### 3.2.1. `GET` - `indexes`
@@ -205,7 +205,7 @@ See [Summarized `task` Object for `202 Accepted`](0060-tasks-api.md#summarized-t
205205
- 🔴 When Meilisearch is secured by a master key, if the API Key used do not have the `indexes.create` action defined, the API returns an [index_not_found](0061-error-format-and-definitions.md#index_not_found) error in the related asynchronous `task` resource. See [3.2.2.2. Response Definition](#3222-response-definition).
206206
- 🔴 Sending a `uid` that already exists returns an [index_already_exists](0061-error-format-and-definitions.md#index_already_exists) error.
207207

208-
#### 3.2.4. `PUT` - `indexes/:index_uid`
208+
#### 3.2.4. `PATCH` - `indexes/:index_uid`
209209

210210
Updates an index.
211211

0 commit comments

Comments
 (0)