Decision rules are constraints added to a personalized offer and applied to a profile to determine eligibility. You can view a list of existing decision rules within a container by performing a single GET request to the Offer Library API.
API format
GET /{ENDPOINT_PATH}/offer-rules?{QUERY_PARAMS}
Parameter | Description | Example |
---|---|---|
{ENDPOINT_PATH} |
The endpoint path for persistence APIs. | https://platform.adobe.io/data/core/dps |
{QUERY_PARAMS} |
Optional query parameters to filter results by. | limit=2 |
You can use query parameters to page and filter results when listing resources.
The most common query parameters for paging include:
Parameter | Description | Example |
---|---|---|
property |
An optional property filter:
|
property=name!=abc&property=id~.*1234.*&property=description equivalent with property=name!=abc,id~.*1234.*,description. |
orderBy |
Sort results by a specific property. Adding a - before name (orderby=-name) will sort items by name in descending order (Z-A). Path expressions are in the form of dot separated paths. This parameter can be repeated like so: orderby=field1[,-fields2,field3,...] |
orderby=id ,-name |
limit |
Limit the number of entities returned. | limit=5 |
Request
curl -X GET 'https://platform.adobe.io/data/core/dps/offer-rules?limit=2' \
-H 'Accept: *,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}'
Response
A successful response returns a list of decision rules that you have access to.
{
"results": [
{
"created": "2022-09-16T18:59:53.651+00:00",
"modified": "2022-09-16T18:59:53.651+00:00",
"etag": 1,
"schemas": [
"https://ns.adobe.com/experience/offer-management/eligibility-rule;version=0.3"
],
"createdBy": "{CREATED_BY}",
"lastModifiedBy": "{MODIFIED_BY}",
"id": "offerRule1234",
"name": "Californians with one or more purchases greater than $1000",
"condition": {
"type": "PQL",
"format": "pql/text",
"value": "homeAddress.stateProvince.equals(\"CA\", false) and (select var1 from xEvent where var1.eventType.equals(\"purchase\", true) and (var1.commerce.order.priceTotal = 1000.0 and var1.commerce.order.currencyCode.equals(\"USD\", false)))"
}
},
{
"created": "2023-03-06T15:11:42.178+00:00",
"modified": "2023-03-06T15:11:42.178+00:00",
"etag": 1,
"schemas": [
"https://ns.adobe.com/experience/offer-management/eligibility-rule;version=0.3"
],
"createdBy": "{CREATED_BY}",
"lastModifiedBy": "{MODIFIED_BY}",
"id": "offerRule5678",
"name": "People born after 1981",
"description": "Persons with the birth date after 1981",
"condition": {
"type": "PQL",
"format": "pql/text",
"value": "person.birthDate occurs after date(1981, 1, 1)"
}
}
],
"count": 2,
"total": 25,
"_links": {
"self": {
"href": "/offer-rules?href={SELF_HREF}&limit=2",
"type": "application/json"
},
"next": {
"href": "/offer-rules?href={NEXT_HREF}&limit=2",
"type": "application/json"
}
}
}