GET/POST/PATCH/DELETE動詞 verbs

對資源執行操作的可用動詞如下:

  • GET:擷取一個元素或元素集合
  • POST:使用引數建立資源。
  • PATCH:使用引數更新資源。
  • DELETE:刪除資源。

範例要求

  • 設定檔集合上的範例GET要求。

    code language-none
    $curl
    -X GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>'
    

    它會傳回設定檔陣列。

    code language-none
    {
        "content": [
            {
                "PKey": "<PKEY>",
                "firstName": "Olivia",
                "lastName": "Varney",
                "birthDate": "1977-09-°4",
                "email": "o.varney@mail.com",
            },
            {
                "PKey": "<PKEY>",
                "firstName": "John",
                "lastName": "Doe",
                "birthDate": "1985-08-17",
                "email": "johndoe@mail.com",
            }
        ],
    }
    
  • 特定設定檔上的範例GET請求。

    code language-none
    $curl
    -X GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY> \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>'
    

    它會傳回請求的設定檔。

    code language-none
    {
        "PKey": "<PKEY>",
        "firstName": "John",
        "lastName": "Doe",
        "birthDate": "1985-08-17",
        "email": "johndoe@mail.com",
        ...
    }
    
  • 建立設定檔的範例POST請求。

    code language-none
    -X POST https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>' \
    -d '{"lastName":"Doe"}'
    

    它會傳回包含預設欄位的設定檔。

    code language-none
    {
        "PKey": "<PKEY>",
        "firstName": "John",
        "lastName": "Doe",
        "birthDate": "1985-08-17",
        "email": "johndoe@mail.com",
    }
    
  • 更新設定檔的範例PATCH請求。

    code language-none
    -X PATCH https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY> \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>' \
    -d '{"firstName":"Mark"',"lastName":"Smith"}'
    

    它會傳回PKEY和URL以擷取更新的設定檔。

    code language-none
    {
        "PKey": "<PKEY>",
        "href": "https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY>"
    }
    
  • 刪除設定檔的範例DELETE請求。

    code language-none
    -X DELETE https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY> \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <ACCESS_TOKEN>' \
    -H 'Cache-Control: no-cache' \
    -H 'X-Api-Key: <API_KEY>'
    

    要求傳回200回應,確認設定檔已刪除。

recommendation-more-help
3ef63344-7f3d-48f9-85ed-02bf569c4fff