> For the complete documentation index, see [llms.txt](https://developer.lpmotor.ru/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.lpmotor.ru/tovary/products.md).

# Экспорт

## Экспорт товаров

{% hint style="warning" %}
Этот метод временно отключен и находится в доработке
{% endhint %}

<mark style="color:blue;">`GET`</mark> `https://api.lpmotor.ru/v1/shop/product/site/{site_id}.{file_type}`

#### Path Parameters

| Name                                         | Type    | Description                                                   |
| -------------------------------------------- | ------- | ------------------------------------------------------------- |
| site\_id<mark style="color:red;">\*</mark>   | integer | ID сайта                                                      |
| file\_type<mark style="color:red;">\*</mark> | string  | Тип файла для выгрузки. Поддерживаемые значения: **csv, yml** |

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | string | API токен       |
| X-Api-User-Id<mark style="color:red;">\*</mark> | string | ID пользователя |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": "base64_encoded_string"
}
```

{% endtab %}

{% tab title="403 " %}

```
{
    "title": "user can`t assess to edit this site",
    "error": 8,
    "code": 403
}
```

{% endtab %}
{% endtabs %}

#### Пример запроса

{% tabs %}
{% tab title="CURL" %}

```bash
curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X GET "https://api.lpmotor.ru/v1/shop/product/site/11111.csv" 
```

{% endtab %}

{% tab title="PHP CURL" %}

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

curl_setopt($ch, CURLOPT_URL, 'https://api.lpmotor.ru/v1/shop/product/site/' . $siteId . '.csv');
curl_setopt(
    $ch,
    CURLOPT_HTTPHEADER,
    [
        'Host: api.lpmotor.ru',
        'X-Api-User-Id: ' . $userId,
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
        'Accept: application/json',
    ]
);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);

$result = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$siteList = json_decode($result, true);

curl_close($ch);
```

{% endtab %}

{% tab title="PHP Guzzle" %}

```php
<?php
$client = new GuzzleHttp\Client([
    'base_uri' => 'https://api.lpmotor.ru',
    'headers'  => [
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
        'X-Api-User-Id' => $userId,
        'Authorization' => 'Bearer ' . $apiKey,
    ],
]);
$response = $client->get(
    '/v1/shop/product/site/' . $siteId . '.csv'
);
$statusCode = $response->getStatusCode();
$productsAsFile = json_decode((string) $response->getBody(), true);
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
http = Axios.create({
    baseURL: "https://api.lpmotor.ru",
    timeout: 60000,
    headers: {
        "Content-Type" : "application/json",
        "Accept"       : "application/json",
        "Cache-Control": "no-cache, no-store, must-revalidate",
        "X-Api-User-Id": userId,
        "Authorization": "Bearer " + myApiKey,
    }
});
http.get("/v1/shop/product/site/" + siteId + ".csv");
```

{% endtab %}
{% endtabs %}

#### Пример запроса
