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

Commit bc2f04b

Browse files
committed
Introduces HTTP Verbs changesto be compliant regarding a Rest API
1 parent 27c7d25 commit bc2f04b

12 files changed

+38
-48
lines changed

open-api.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,10 +1148,10 @@ paths:
11481148
$ref: '#/components/responses/401'
11491149
'404':
11501150
description: Not Found
1151-
put:
1151+
patch:
11521152
operationId: indexes.update
11531153
summary: Update Index
1154-
description: Update an index. Add a primaryKey if it doesn't already exists yet.
1154+
description: Update an index. Specify a primaryKey if it doesn't already exists yet.
11551155
tags:
11561156
- Indexes
11571157
security:
@@ -1754,7 +1754,7 @@ paths:
17541754
$ref: '#/components/responses/401'
17551755
'404':
17561756
description: Not Found
1757-
post:
1757+
patch:
17581758
operationId: indexes.settings.update
17591759
summary: Update settings
17601760
description: |
@@ -1891,7 +1891,7 @@ paths:
18911891
$ref: '#/components/responses/401'
18921892
'404':
18931893
description: Not Found
1894-
post:
1894+
put:
18951895
operationId: indexes.settings.synonyms.update
18961896
summary: Update synonyms
18971897
description: |
@@ -1959,7 +1959,7 @@ paths:
19591959
$ref: '#/components/responses/401'
19601960
'404':
19611961
description: Not Found
1962-
post:
1962+
put:
19631963
operationId: indexes.settings.sortable-attributes.update
19641964
summary: Update sortable attributes
19651965
description: |
@@ -2034,7 +2034,7 @@ paths:
20342034
$ref: '#/components/responses/401'
20352035
'404':
20362036
description: Not Found
2037-
post:
2037+
put:
20382038
operationId: indexes.settings.stopWords.update
20392039
summary: Update stop-words
20402040
description: |
@@ -2102,7 +2102,7 @@ paths:
21022102
$ref: '#/components/responses/401'
21032103
'404':
21042104
description: Not Found
2105-
post:
2105+
put:
21062106
operationId: indexes.settings.rankingRules.update
21072107
summary: Update ranking rules
21082108
description: |
@@ -2180,7 +2180,7 @@ paths:
21802180
$ref: '#/components/responses/401'
21812181
'404':
21822182
description: Not Found
2183-
post:
2183+
patch:
21842184
operationId: indexes.settings.typoTolerance.update
21852185
summary: Update typo tolerance settings
21862186
description: |
@@ -2248,7 +2248,7 @@ paths:
22482248
$ref: '#/components/responses/401'
22492249
'404':
22502250
description: Not Found
2251-
post:
2251+
put:
22522252
operationId: indexes.settings.filterableAttributes.update
22532253
summary: Update Filterable Attributes
22542254
description: |
@@ -2317,7 +2317,7 @@ paths:
23172317
$ref: '#/components/responses/401'
23182318
'404':
23192319
description: Not Found
2320-
post:
2320+
put:
23212321
operationId: indexes.settings.distinctAttribute.update
23222322
summary: Update distinct attribute
23232323
description: |
@@ -2384,7 +2384,7 @@ paths:
23842384
$ref: '#/components/responses/401'
23852385
'404':
23862386
description: Not Found
2387-
post:
2387+
put:
23882388
operationId: indexes.settings.searchableAttributes.update
23892389
summary: Update searchable attributes
23902390
description: |
@@ -2450,7 +2450,7 @@ paths:
24502450
$ref: '#/components/responses/401'
24512451
'404':
24522452
description: Not Found
2453-
post:
2453+
put:
24542454
operationId: indexes.settings.displayedAttributes.update
24552455
summary: Update displayed attributes
24562456
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
@@ -91,7 +91,7 @@ Manipulate indexes of a Meilisearch instance.
9191
- [3.2.1. `GET` - `indexes`](#321-get---indexes)
9292
- [3.2.2. `GET` - `indexes/:index_uid`](#322-get---indexesindexuid)
9393
- [3.2.3. `POST` - `indexes`](#323-post---indexes)
94-
- [3.2.4. `PUT` - `indexes/:index_uid`](#324-put---indexesindexuid)
94+
- [3.2.4. `PATCH` - `indexes/:index_uid`](#324-patch---indexesindexuid)
9595
- [3.2.5. `DELETE` - `indexes/:index_uid`](#325-delete---indexesindexuid)
9696

9797
#### 3.2.1. `GET` - `indexes`
@@ -155,7 +155,7 @@ See [Summarized `task` Object for `202 Accepted`](0060-tasks-api.md#summarized-t
155155
- 🔴 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).
156156
- 🔴 Sending a `uid` that already exists returns an [index_already_exists](0061-error-format-and-definitions.md#index_already_exists) error.
157157

158-
#### 3.2.4. `PUT` - `indexes/:index_uid`
158+
#### 3.2.4. `PATCH` - `indexes/:index_uid`
159159

160160
Updates an index.
161161

0 commit comments

Comments
 (0)