Create a ranking formula
Last update: March 10, 2025
- Topics:
- Decision Management
- API
- Collections
CREATED FOR:
- Experienced
- Developer
You can create a ranking formula by making a POST request to the Offer Library API.
Accept and Content-Type headers
The following table shows the valid values which comprise the Content-Type fields in the request header:
Header name | Value |
---|---|
Content-Type | application/json |
API format
POST /{ENDPOINT_PATH}/ranking-formulas
Parameter | Description | Example |
---|---|---|
{ENDPOINT_PATH} | The endpoint path for persistence APIs. | https://platform.adobe.io/data/core/dps |
Request
curl -X POST 'https://platform.adobe.io/data/core/dps/ranking-formulas' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {IMS_ORG}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-d '{
"name": "Test Ranking Function DPS",
"description": "Ranking function description",
"exdFunction": true,
"returnType": {
"type": "integer"
},
"expression": {
"type": "PQL",
"format": "pql/text",
"value": "if(offer.rank.priority.isNotNull(), offer.rank.priority, 0) * if(offer.tags.intersects(boosted.tags), 2, 1)"
},
"definedOn": {
"offer": {
"schema": {
"altId": "_experience.offer-management.personalized-offer",
"version": "0"
}
},
"boosted": {
"schema": {
"altId": "_xdm.context.foo",
"version": "0"
}
}
}
}'
Response
A successful response returns the details of the newly created ranking formula including the id
. You can use the id
in later steps to update or delete your ranking formula.
{
"etag": 1,
"createdBy": "{CREATED_BY}",
"lastModifiedBy": "{MODIFIED_BY}",
"id": "{ID}",
"sandboxId": "{SANDBOX_ID}",
"createdDate": "2023-05-31T15:09:11.771Z",
"lastModifiedDate": "2023-05-31T15:09:11.771Z",
"createdByClientId": "{CREATED_CLIENT_ID}",
"lastModifiedByClientId": "{MODIFIED_CLIENT_ID}"
}
recommendation-more-help
b22c9c5d-9208-48f4-b874-1cefb8df4d76