## Search products and assigned prices in a specific price list

### cURL

```
curl --request POST \
  --url https://live.copilot.fabric.inc/api-offers/items/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '\n{\n  "offset": 0,\n  "limit": 10,\n  "keyword": "CAN",\n  "sku": true,\n  "isListView": true,\n  "priceListId": 123\n}'
```

### Python Example

```
import requests

url = "https://live.copilot.fabric.inc/api-offers/items/search"

payload = {
    "offset": 0,
    "limit": 10,
    "keyword": "CAN",
    "sku": True,
    "isListView": True,
    "priceListId": 123
}
headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
```

### JavaScript Example

```
const options = {
  method: 'POST',
  headers: {
    'x-site-context': '<x-site-context>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    offset: 0,
    limit: 10,
    keyword: 'CAN',
    sku: true,
    isListView: true,
    priceListId: 123
  })
};

fetch('https://live.copilot.fabric.inc/api-offers/items/search', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP Example

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://live.copilot.fabric.inc/api-offers/items/search",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'offset' => 0,
    'limit' => 10,
    'keyword' => 'CAN',
    'sku' => true,
    'isListView' => true,
    'priceListId' => 123
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "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 Example

```
package main

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

func main() {

url := "https://live.copilot.fabric.inc/api-offers/items/search"

payload := strings.NewReader("{\n  \"offset\": 0,\n  \"limit\": 10,\n  \"keyword\": \"CAN\",\n  \"sku\": true,\n  \"isListView\": true,\n  \"priceListId\": 123\n}")

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

req.Header.Add("x-site-context", "<x-site-context>")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Response Structure

#### Success Response (200)

```json
{
  "query": {
    "limit": 10,
    "offset": 0,
    "count": 50
  },
  "results": [
    {
      "variants": [
        "VARIANT-01",
        "VARIANT-55"
      ],
      "itemId": 1000002411,
      "channel": [
        12,
        13
      ],
      "isDefault": true,
      "state": "READY",
      "createdAt": "2020-12-14T12:15:43.646Z",
      "updatedAt": "2020-12-14T12:15:43.646Z",
      "startDate": "2020-12-14T12:14:35.331Z",
      "endDate": "2020-12-14T12:14:35.331Z",
      "isActive": true,
      "sku": "WALL123",
      "title": "wall posters",
      "images": [
        {
          "id": "5fd7577251a93f0007e48383",
          "order": 0,
          "label": "https://abchome-xpm-images.s3.amazonaws.com/12.01.20+Giving+Tuesday/Homepage/HP_HolidaySix_GI_1.jpg?w=1067",
          "source": [
            {
              "id": "5fd7577251a93f0007e48383",
              "url": "https://abchome-xpm-images.s3.amazonaws.com/12.01.20+Giving+Tuesday/Homepage/HP_HolidaySix_GI_1.jpg?w=1067"
            }
          ]
        }
      ],
      "price": {
        "sale": 2800,
        "cost": 2500,
        "currency": "USD",
        "base": 3000
      },
      "kind": {
        "priceKindId": 12,
        "name": "Clearance",
        "channel": 12
      },
      "priceStartDate": "2021-01-06T19:00:00+00:00",
      "priceEndDate": "2099-12-31T18:59:00+00:00",
      "priceLastUpdatedAt": "2099-12-31T18:59:00+00:00",
      "status": "ACTIVE",
      "basePriceRange": {
        "min": 100,
        "max": 300
      },
      "salePriceRange": {
        "min": 100,
        "max": 300
      },
      "costPriceRange": {
        "min": 100,
        "max": 300
      },
      "items": [
        {
          "variants": [
            "VARIANT-01",
            "VARIANT-55"
          ],
          "itemId": 1000002411,
          "channel": [
            12,
            13
          ],
          "isDefault": true,
          "state": "READY",
          "createdAt": "2020-12-14T12:15:43.646Z",
          "updatedAt": "2020-12-14T12:15:43.646Z",
          "startDate": "2020-12-14T12:14:35.331Z",
          "endDate": "2020-12-14T12:14:35.331Z",
          "isActive": true,
          "sku": "WALL123",
          "title": "wall posters",
          "images": [
            {
              "id": "5fd7577251a93f0007e48383",
              "order": 0,
              "label": "https://abchome-xpm-images.s3.amazonaws.com/12.01.20+Giving+Tuesday/Homepage/HP_HolidaySix_GI_1.jpg?w=1067",
              "source": [
                {
                  "id": "5fd7577251a93f0007e48383",
                  "url": "https://abchome-xpm-images.s3.amazonaws.com/12.01.20+Giving+Tuesday/Homepage/HP_HolidaySix_GI_1.jpg?w=1067"
                }
              ]
            }
          ],
          "price": {
            "sale": 2800,
            "cost": 2500,
            "currency": "USD",
            "base": 3000
          },
          "kind": {
            "priceKindId": 12,
            "name": "Clearance",
            "channel": 12
          },
          "priceStartDate": "2021-01-06T19:00:00+00:00",
          "priceEndDate": "2099-12-31T18:59:00+00:00",
          "status": "ACTIVE"
        }
      ]
    }
  ]
}
```

#### Error Response (e.g., Price List Data Not Found)

```json
{
  "code": "PRICE_LIST_DATA_NOT_FOUND",
  "message": "Price list ID not found"
}
```

```json
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error."
}
```

### Authorizations

- **Authorization**: Bearer token as a header.

### Headers
- `x-site-context`: A JSON object containing source information.
