## End specific sku-list

### cURL

```bash
curl --request POST \
  --url https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId}/end-now \
  --header 'Authorization: Bearer <token>' \
  --header 'x-site-context: <x-site-context>'
```

### Python

```python
import requests

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

headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers)

print(response.text)
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'x-site-context': '<x-site-context>', Authorization: 'Bearer <token>'}
};

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

### PHP

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId}/end-now",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "x-site-context: <x-site-context>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {
	url := "https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId}/end-now"

req, _ := http.NewRequest("POST", url, nil)

req.Header.Add("x-site-context", "<x-site-context>")
	req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	
	fmt.Println(string(body))
}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId}/end-now")
  .header("x-site-context", "<x-site-context>")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### Ruby

```ruby
require 'uri'
require 'net/http'

url = URI("https://live.copilot.fabric.inc/api-offers/sku-list/{skuListId}/end-now")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

### Status Codes

- **200**: Success
- **400**: Bad Request
- **500**: Internal Server Error

### Example JSON Responses

#### Successful Response
```json
{
  "_id": "614b58924e92f6861ac9d43b",
  "title": "GlobalExc_1",
  "listType": "GLOBAL_EXCLUSION",
  "applicableOn": ["PRODUCT_PRICE"],
  "targetProducts": [{
      "kind": "SKU",
      "value": [1000000123]
  }],
  "startDate": "2021-05-04T09:23:51.459Z",
  "endDate": "2021-05-04T09:23:51.459Z",
  "deleted": true,
  "createdAt": "2020-12-14T12:15:43.646Z",
  "updatedAt": "2021-12-14T12:15:43.646Z"
}
```

#### Bad Request Response
```json
{
  "code": "BAD_REQUEST",
  "message": "Bad Request"
}
```

#### Internal Server Error Response
```json
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error."
}
```

### Authorizations

#### **Authorization**
- Type: `string`
- Requirement: required
- Description: Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.

### Headers

#### **x-site-context**
- Type: `string`
- Requirement: required
- Description: The `x-site-context` header is a JSON object that contains information about the source you wish to pull from. The mandatory `account` is the 24 character identifier found in Copilot.  The `channel`, `stage`, and `date` attributes can be used to further narrow the scope of your data source.

**Example**:
```json
{"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account": "1234abcd5678efgh9ijklmno","stage":"production"}
```

### Path Parameters

#### **skuListId**
- Type: `number`
- Requirement: required
- Description: ID of the list to end.

### Response

- **200**: application/json
- OK
  - **_id**: string - A 24-character system-generated ID of the record.
  - **title**: string - SkuList name/title.
  - **listType**: enum<string> - Type of skulist, Available options: `GLOBAL_EXCLUSION`.
  - **applicableOn**: enum<string>[] - Applicable scope of skulist, Available options: `PRODUCT_PRICE`, `SHIPPING_PRICE`.
  - **targetProducts**: object[] - Showchild attributes.
  - **startDate**: string<date-time> - Start date of the sku-list.
  - **endDate**: string<date-time> - End date of sku-list.
  - **deleted**: boolean - true: sku-list is deleted, false: sku-list is not deleted.
  - **createdAt**: string<date-time> - Creation date of the record.
  - **updatedAt**: string<date-time> - Last updated date of the record.
