Update specific sku-list - Fabric

Update specific sku-list

cURL

curl --request PUT \
  --url https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '\n{\n  "title": "GlobalExc_1",\n  "applicableOn": [\n    "PRODUCT_PRICE"\n  ],\n  "targetProducts": [\n    {\n      "kind": "SKU",\n      "value": [\n        1000000123\n      ]\n    }\n  ],\n  "startDate": "2022-05-04T09:23:51.459Z",\n  "endDate": "2099-12-31T00:00:00.000Z",\n  "listType": "GLOBAL_EXCLUSION",\n  "deleted": false,\n  "createdAt": "2020-12-14T12:15:43.646Z",\n  "updatedAt": "2021-12-14T12:15:43.646Z"\n}\n'```

### Python Example

```python
import requests

url = "https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId}"

payload = {
    "title": "GlobalExc_1",
    "applicableOn": ["PRODUCT_PRICE"],
    "targetProducts": [\
        {\
            "kind": "SKU",\
            "value": [1000000123]\
        }\
    ],
    "startDate": "2022-05-04T09:23:51.459Z",
    "endDate": "2099-12-31T00:00:00.000Z",
    "listType": "GLOBAL_EXCLUSION",
    "deleted": False,
    "createdAt": "2020-12-14T12:15:43.646Z",
    "updatedAt": "2021-12-14T12:15:43.646Z"
}
headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)

JavaScript Fetch Example

const options = {
  method: 'PUT',
  headers: {
    'x-site-context': '<x-site-context>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'GlobalExc_1',
    applicableOn: ['PRODUCT_PRICE'],
    targetProducts: [{kind: 'SKU', value: [1000000123]}],
    startDate: '2022-05-04T09:23:51.459Z',
    endDate: '2099-12-31T00:00:00.000Z',
    listType: 'GLOBAL_EXCLUSION',
    deleted: false,
    createdAt: '2020-12-14T12:15:43.646Z',
    updatedAt: '2021-12-14T12:15:43.646Z'
  })
};

fetch('https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Response Structure

{
  "_id": "614b58924e92f6861ac9d43b",
  "title": "GlobalExc_1",
  "listType": "GLOBAL_EXCLUSION",
  "applicableOn": ["PRODUCT_PRICE"],
  "targetProducts": [{"kind": "SKU","value": [1000000123]}],
  "startDate": "2022-05-04T09:23:51.459Z",
  "endDate": "2099-12-31T00:00:00.000Z",
  "deleted": false,
  "createdAt": "2020-12-14T12:15:43.646Z",
  "updatedAt": "2021-12-14T12:15:43.646Z"
}