Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions specs/composition/paths/compositions/updateSortingStrategy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
post:
tags:
- Compositions
operationId: updateSortingStrategyComposition
x-acl:
- editSettings
summary: Set or update the "sortingStrategy" configuration for an existing composition
description: |
Updates the "sortingStrategy" field of an existing composition.
This endpoint allows you to create a new sorting strategy mapping or replace the currently configured one.
The provided sorting indices must be associated indices or replicas of the main targeted index.

The update is applied to the specified composition within the current Algolia application and returns a taskID that can be used to track the operation’s completion.
parameters:
- $ref: '../urlParams.yml#/compositionID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../common/schemas/components/Composition.yml#/sortingStrategy'
responses:
'200':
description: OK
content:
application/json:
schema:
title: taskIDResponse
type: object
additionalProperties: false
properties:
taskID:
$ref: '../../../common/responses/common.yml#/taskID'
required:
- taskID
'400':
$ref: '../../../common/responses/BadRequest.yml'
'402':
$ref: '../../../common/responses/FeatureNotEnabled.yml'
'403':
$ref: '../../../common/responses/MethodNotAllowed.yml'
'404':
$ref: '../../../common/responses/CompositionNotFound.yml'
2 changes: 2 additions & 0 deletions specs/composition/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ paths:
$ref: 'paths/compositions/composition.yml'
/1/compositions/*/batch:
$ref: 'paths/compositions/batch.yml'
/1/compositions/{compositionID}/sortingStrategy:
$ref: 'paths/compositions/updateSortingStrategy.yml'

# ##########################################
# ### Manage Composition Rules Endpoints ###
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"parameters": {
"compositionID": "my-compo",
"requestBody": {
"Price-asc": "products-low-to-high",
"Price-desc": "products-high-to-low"
}
},
"request": {
"path": "/1/compositions/my-compo/sortingStrategy",
"method": "POST",
"body": {
"Price-asc": "products-low-to-high",
"Price-desc": "products-high-to-low"
}
}
}
]