## Find items

### cURL

```
curl --request GET \
  --url https://live.copilot.fabric.inc/api-product/v1/product/search \
  --header 'Authorization: Bearer <token>' \
  --header 'x-site-context: <x-site-context>'
```

### Python

```
import requests

url = "https://live.copilot.fabric.inc/api-product/v1/product/search"

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

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

print(response.text)
```

### JavaScript (Fetch)

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

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

### PHP

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://live.copilot.fabric.inc/api-product/v1/product/search",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  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

```
package main

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

func main() {

url := "https://live.copilot.fabric.inc/api-product/v1/product/search"

req, _ := http.NewRequest("GET", 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 (Unirest)

```
HttpResponse<String> response = Unirest.get("https://live.copilot.fabric.inc/api-product/v1/product/search")
  .header("x-site-context", "<x-site-context>")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### Ruby

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

url = URI("https://live.copilot.fabric.inc/api-product/v1/product/search")

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

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

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

### Responses

#### Successful Response (200)

```json
{
  "totalSize": 100,
  "pageSize": 10,
  "pages": 10,
  "products": [
    {
      "sku": "MSI-Z490",
      "itemId": 2,
      "type": "ITEM",
      "categories": [
        {
          "id": "621c121bff2e4507c199b7cb",
          "name": "electronics",
          "nodeId": 30,
          "breadcrumbs": [
            {
              "id": "621c10f3ff2e4507c199b66b",
              "nodeId": 31,
              "name": "PRIMARY",
              "attributes": [
                {
                  "id": "619a8ba6f1875f6dbcaf0521",
                  "name": "notes",
                  "description": "Notes for this particular category.",
                  "type": "TEXT",
                  "value": "Unable to fulfill demand.",
                  "mapping": "description"
                }
              ]
            }
          ]
        }
      ],
      "attributes": [
        {
          "id": "619a8ba6f1875f6dbcaf0521",
          "name": "notes",
          "description": "Notes for this particular category.",
          "type": "TEXT",
          "value": "Unable to fulfill demand.",
          "mapping": "description"
        }
      ],
      "dependents": [
        [
          "Child1",
          "Child2"
        ]
      ],
      "createdOn": "2021-05-28T16:36:50.055Z",
      "modifiedOn": "2021-05-28T16:36:50.055Z",
      "children": [
        {
          "sku": "<string>",
          "attributes": [
            {
              "id": "619a8ba6f1875f6dbcaf0521",
              "name": "notes",
              "description": "Notes for this particular category.",
              "type": "TEXT",
              "value": "Unable to fulfill demand.",
              "mapping": "description"
            }
          ]
        }
      ]
    }
  ]
}
```

#### Client Error (400)

```json
{
  "code": 400,
  "message": "Client error"
}
```

#### Internal Error (500)

```json
{
  "code": 500,
  "message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}
```

### Header Parameters

#### Authorization
- Type: string
- Required: Yes
- Description: S2S access token (JWT) from fabric Identity service (during Login)

#### x-site-context
- Type: string
- Required: Yes
- Description: Information about the source you wish to pull from.

### Query Parameters

- **keyword**:  (string) Keywords related to SKU or title.
- **skus**:  (array) Searches for items based on SKU.
- **itemIds**:  (array) Item IDs.
- **page**:  (number) Page number to be retrieved.
- **size**:  (integer) Number of records per page.
- **type**:  (enum) Item type.
- **allAttributes**:  (boolean) true: Gets all attributes, false: Gets only the mapped attributes.
- **excludeChildren**:  (boolean) Excludes children items.
- **onlyChildren**:  (boolean) Excludes parent items.
