APIを介した注文データの同期

バックエンドを介した注文データの同期(推奨)

注文データをEpsilon Retail Mediaに送信するには、以下のようなコマンドを使用します。以下のordersフィールドのデータはダミーで、説明の例として示しています。ここで示しているのはすべて標準的な統合の例です。

📘

マーケットプレイス出品者IDを統合していますか?

以下の「マーケットプレイス出品者ID」セクションを必ずお読みください。

単品の注文

以下は、1つの商品を購入した顧客のコンテキストです。

POST $BASE_URL/v1/orders HTTP/1.1 
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "sessionId": "5cat7-9964-4f",
        "dtmcookieid": "DTM_COOKIE_ID",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",  
                  "quantity": 3, 
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            }
    ]
}

成功すると、以下のオブジェクトが返されます。

HTTP/2 200
{
    "orders": [
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "dtmcookieid": "aaa_bbb_e345D",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z",
        }
    ]
}
🚧

orderDateの形式

上記の形式のorderDateはUTC時間として読み取られるため、UTCで同期する必要があります。

また、タイムゾーンのオフセットを設定することもできます。その場合は、対象のタイムゾーンに応じた+HH:MMとしてZに置き換えます。例:“orderDate”:タイムゾーンを指定する“2021-12-02T15:00:00+10:00"は、タイムゾーンがUTC+10であることを示しています。

複数品の注文

以下は、複数の商品を購入した顧客のコンテキストです。orderItems配列に複数の商品があります。

POST $BASE_URL/v1/orders HTTP/1.1 
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "sessionId": "5cat7-9964-4f",
        "dtmcookieid": "DTM_COOKIE_ID",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",  
                  "quantity": 3, 
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"             
                }
              ]
            },
          {
                  "gtin": "9891998566P",  
                  "quantity": 3, 
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"            
                }
              ]
            }
    ]
}

成功すると、以下のオブジェクトが返されます。

HTTP/2 200
{
    "orders": [
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "dtmcookieid": "aaa_bbb_e345D",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                },
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z",
        }
    ]
}

複数注文の同期

複数の注文を同期させる場合、各リクエストで最大100個のアイテムを一括で送信できます。リクエストの回数に上限はありません。プッシュされたペイロードの順序は、返された結果と同じ順序です。これにより、バックエンドの注文表現とのデータの整合性を維持できます。

POST $BASE_URL/v1/orders HTTP/1.1 
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "sessionId": "5cat7-9964-4f",
        "dtmcookieid": "DTM_COOKIE_ID",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",  
                  "quantity": 3, 
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"              
                }
              ]
            },
        {
      		  "customerId": "rw3-v3ag-ol0",
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "sessionId": "2m342-2dfe-0f",
      		  "orderDate": "2021-12-02T15:00:00Z",
      		  "id": "i32dm3e4-c158-43d78-43ww32x-m2ide3e3",
      		  "orderItems": [
            {
                  "gtin": "9891998566P",  
                  "quantity": 3, 
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"              
                }
              ]
            }
    ]
}

成功すると、以下のオブジェクトが返されます。

HTTP/2 200
{
    "orders": [
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "dtmcookieid": "aaa_bbb_e345D",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z"
        },
        {
            "teamId": "a7e5cat7-9964-4ff3-bbb1-94bf9b53a366",
            "customerId": "npc-s243-ir",
            "sessionId": "5cat7-9964-4f",
            "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
            "orderItems": [
                {
                    "regularUnitPrice": 1.00,
                    "citrusDiscountAmount": null,
                    "gtin": "9891998566P",
                    "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                    "quantity": 3,
                    "substitutedFor": null,
                    "totalOrderItemPriceAfterDiscounts": 3.00,
                    "sellerId": "seller_id_601_64",
                }
            ],
            "orderDate": "2021-12-02T15:00:00Z"
        }
    ]
}

マーケットプレイス出品者ID

マーケットプレイス出品者をオンボーディングしている場合は、注文の報告時にsellerIdを同期する必要があります(該当するものがある場合)。購入した商品にsellerIdがない場合は、省略することができます。

❗️

マーケットプレイス出品者をオンボーディングしている場合は、注文レポートでSellerIdを指定する必要はありません

以下は、1つの商品がマーケットプレイス出品者からの商品で、もう1つがマーケットプレイスの商品ではない場合の注文の例です。

POST $BASE_URL/v1/orders HTTP/1.1 
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "orders": [
       {
        "customerId": "npc-s243-ir",
        "teamId": "9f48572c-0a5b-4997-9a0e-ed74f4d32dc6",
        "dtmcookieid": "DTM_COOKIE_ID",
        "sessionId": "5cat7-9964-4f",
        "orderDate": "2021-12-02T15:00:00Z",
        "id": "3h30e938-c158-4d78-a0af-b48bbwfrcss4",
        "orderItems": [
            {
                  "gtin": "9891998566P",  
                  "quantity": 3, 
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,
                  "sellerId": "seller_id_601_64"
                }
              ]
            },
          {
                  "gtin": "9891998566P",  
                  "quantity": 3, 
                  "regularUnitPrice": 1.00,
                  "totalOrderItemPriceAfterDiscounts": 3.00,
                  "catalogId": "6adb93d0-7he4-4d4e-9b47-e5d3714c976a",
                  "citrusDiscountAmount": 0.0,
                  "substitutedFor": null,            
                }
              ]
            }
    ]
}

注文情報の取得

Epsilon Retail Media内で注文情報を確認したい場合は、注文IDを指定して/orders/ APIにGETリクエストを行います。

GET $BASE_URL/v1/orders/<ORDER_ID> HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>

You will retrieve all information related to the order stored within the Epsilon Retail Media system.
In the event the order is not found, it has likely not been ingested into the Epsilon Retail Media system.