清單決定規則

上次更新: 2023-12-29
  • 建立對象:
  • Experienced
    Developer

決定規則是新增至個人化優惠的限制,並套用至設定檔以判斷適用性。 您可以透過對以下執行單一GET請求,檢視容器內現有的決定規則清單: Offer Library API。

API格式

GET /{ENDPOINT_PATH}/offer-rules?{QUERY_PARAMS}
參數 說明 範例
{ENDPOINT_PATH} 持續性API的端點路徑。 https://platform.adobe.io/data/core/dps
{QUERY_PARAMS} 篩選結果的選用查詢引數。 limit=2

使用查詢引數

您可以在列出資源時,使用查詢引數來頁面和篩選結果。

分頁

分頁最常見的查詢引數包括:

參數 說明 範例
property 選用的屬性篩選器:
  • 屬性會依AND作業分組。
  • 引數可以重複執行,如下所示:property={PROPERTY_EXPR}[屬性(&P)={PROPERTY_EXPR2}…] 或屬性={PROPERTY_EXPR1}[,{PROPERTY_EXPR2}…]
  • 屬性運算式的格式為 [ !]field[op]value,使用 op[==,!=,<=,>=,<,>,~],支援規則運算式。
property=name!=abc&property=id~.*1234.*&property=description equivalent with property=name!=abc,id~.*1234.*,description.
orderBy 依特定屬性排序結果。 在名稱前新增 — (orderby=-name)將會以降序順序(Z-A)依名稱排序專案。 路徑運算式採用點分隔路徑的形式。 此引數可重複執行,如下所示: orderby=field1[,-fields2,field3,...] orderby=id-name
limit 限制傳回的實體數。 limit=5

要求

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}'

回應

成功的回應會傳回您有權存取的決定規則清單。

{
     "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"
        }
    }
}

本頁內容