Mottor API
Search…
Продукты
get
https://api.lpmotor.ru
/v1/shop/product/site/{site_id}
Получение списка продуктов

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

CURL
PHP CURL
PHP Guzzle
JavaScript
1
curl \
2
-H "Accept: application/json" \
3
-H "Content-Type: application/json" \
4
-H "X-Api-User-Id: <<Your-user-id>>" \
5
-H "Authorization: Bearer <<Your-API-token>>" \
6
-X GET "https://api.lpmotor.ru/v1/shop/product/site/11111"
Copied!
1
<?php
2
$ch = curl_init();
3
4
curl_setopt($ch, CURLOPT_URL, 'https://api.lpmotor.ru/v1/shop/product/site/1');
5
curl_setopt(
6
$ch,
7
CURLOPT_HTTPHEADER,
8
[
9
'Host: api.lpmotor.ru',
10
'Authorization: Bearer ' . $apiKey,
11
'Content-type: application/json',
12
'Accept: application/json',
13
]
14
);
15
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
16
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
17
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
18
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
19
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
20
21
$result = curl_exec($ch);
22
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
23
$bodyArray = json_decode($result, true);
24
25
curl_close($ch);
26
27
var_dump($statusCode, $bodyArray);
Copied!
1
<?php
2
$client = new GuzzleHttp\Client([
3
'base_uri' => 'https://api.lpmotor.ru',
4
'headers' => [
5
'Content-Type' => 'application/json',
6
'Accept' => 'application/json',
7
'X-Api-User-Id' => $userId,
8
'Authorization' => 'Bearer ' . $apiKey,
9
],
10
]);
11
$response = $client->get(
12
'/v1/shop/product/site/' . $siteId
13
);
14
$statusCode = $response->getStatusCode();
15
$products = json_decode((string) $response->getBody(), true);
Copied!
1
http = Axios.create({
2
baseURL: "https://api.lpmotor.ru",
3
timeout: 60000,
4
headers: {
5
"Content-Type" : "application/json",
6
"Accept" : "application/json",
7
"Cache-Control": "no-cache, no-store, must-revalidate",
8
"X-Api-User-Id": userId,
9
"Authorization": "Bearer " + myApiKey,
10
}
11
});
12
http.get("/v1/shop/product/site/" + siteId);
Copied!
get
https://api.lpmotor.ru
/v1/shop/product/site/{site_id}.{file_type}
Экспорт продуктов

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

CURL
PHP CURL
PHP Guzzle
JavaScript
1
curl \
2
-H "Accept: application/json" \
3
-H "Content-Type: application/json" \
4
-H "X-Api-User-Id: <<Your-user-id>>" \
5
-H "Authorization: Bearer <<Your-API-token>>" \
6
-X GET "https://api.lpmotor.ru/v1/shop/product/site/11111.csv"
Copied!
1
<?php
2
$ch = curl_init();
3
4
curl_setopt($ch, CURLOPT_URL, 'https://api.lpmotor.ru/v1/shop/product/site/' . $siteId . '.csv');
5
curl_setopt(
6
$ch,
7
CURLOPT_HTTPHEADER,
8
[
9
'Host: api.lpmotor.ru',
10
'X-Api-User-Id: ' . $userId,
11
'Authorization: Bearer ' . $apiKey,
12
'Content-Type: application/json',
13
'Accept: application/json',
14
]
15
);
16
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
17
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
18
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
19
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
20
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
21
22
$result = curl_exec($ch);
23
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
24
$siteList = json_decode($result, true);
25
26
curl_close($ch);
Copied!
1
<?php
2
$client = new GuzzleHttp\Client([
3
'base_uri' => 'https://api.lpmotor.ru',
4
'headers' => [
5
'Content-Type' => 'application/json',
6
'Accept' => 'application/json',
7
'X-Api-User-Id' => $userId,
8
'Authorization' => 'Bearer ' . $apiKey,
9
],
10
]);
11
$response = $client->get(
12
'/v1/shop/product/site/' . $siteId . '.csv'
13
);
14
$statusCode = $response->getStatusCode();
15
$productsAsFile = json_decode((string) $response->getBody(), true);
Copied!
1
http = Axios.create({
2
baseURL: "https://api.lpmotor.ru",
3
timeout: 60000,
4
headers: {
5
"Content-Type" : "application/json",
6
"Accept" : "application/json",
7
"Cache-Control": "no-cache, no-store, must-revalidate",
8
"X-Api-User-Id": userId,
9
"Authorization": "Bearer " + myApiKey,
10
}
11
});
12
http.get("/v1/shop/product/site/" + siteId + ".csv");
Copied!
post
https://api.lpmotor.ru
/v1/shop/product/import
Импорт продуктов

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

CURL
PHP CURL
PHP Guzzle
JavaScript
1
curl \
2
-H "Accept: application/json" \
3
-H "Content-Type: application/json" \
4
-H "X-Api-User-Id: <<Your-user-id>>" \
5
-H "Authorization: Bearer <<Your-API-token>>" \
6
-X POST "https://api.lpmotor.ru/v1/shop/product/import" \
7
-d '{"data_file":"aWQsc2t1LG5hbWUsZGVzY3JpcHRpb24scHJpY2UsaXNfdmlzaWJsZSxvbGRfcHJpY2Usc2hvcnRfZGVzY3JpcHRpb24sZGVzY3JpcHRpb25fdXJsLGNhdGVnb3J5X2xpc3QsaW1hZ2VfdXJsCjM0NywsInByb2R1Y3QgbmFtZSIsLDEyMywxLCwsLCJjYXRlZ29yeSBuYW1lOyIsCg==","site_id":11111,"file_type":"csv"}'
Copied!
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'http://localhost:8083/v1/shop/product/import',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>'{
15
"site_id": 19232,
16
"file_type": "csv",
17
"data_file": ""
18
}',
19
CURLOPT_HTTPHEADER => array(
20
'Authorization: Bearer ' . $apiKey,
21
'Content-Type: application/json'
22
),
23
));
24
25
$response = curl_exec($curl);
26
27
curl_close($curl);
28
echo $response;
29
Copied!
1
<?php
2
$client = new GuzzleHttp\Client([
3
'base_uri' => 'https://api.lpmotor.ru',
4
'headers' => [
5
'Content-Type' => 'application/json',
6
'Accept' => 'application/json',
7
'X-Api-User-Id' => $userId,
8
'Authorization' => 'Bearer ' . $apiKey,
9
],
10
]);
11
$response = $client->post(
12
'/v1/shop/product/import',
13
[
14
'json' => [
15
'data_file' => 'aWQsc2t1LG5hbWUsZGVzY3JpcHRpb24scHJpY2UsaXNfdmlzaWJsZSxvbGRfcHJpY2Usc2hvcnRfZGVzY3JpcHRpb24sZGVzY3JpcHRpb25fdXJsLGNhdGVnb3J5X2xpc3QsaW1hZ2VfdXJsCjM0NywsInByb2R1Y3QgbmFtZSIsLDEyMywxLCwsLCJjYXRlZ29yeSBuYW1lOyIsCg==',
16
'site_id' => $siteId,
17
'file_type' => 'csv',
18
],
19
]
20
);
21
$statusCode = $response->getStatusCode();
Copied!
1
http = Axios.create({
2
baseURL: "https://api.lpmotor.ru",
3
timeout: 60000,
4
headers: {
5
"Content-Type" : "application/json",
6
"Accept" : "application/json",
7
"Cache-Control": "no-cache, no-store, must-revalidate",
8
"X-Api-User-Id": userId,
9
"Authorization": "Bearer " + myApiKey,
10
}
11
});
12
http.post('/v1/shop/product/import', {
13
data_file: 'aWQsc2t1LG5hbWUsZGVzY3JpcHRpb24scHJpY2UsaXNfdmlzaWJsZSxvbGRfcHJpY2Usc2hvcnRfZGVzY3JpcHRpb24sZGVzY3JpcHRpb25fdXJsLGNhdGVnb3J5X2xpc3QsaW1hZ2VfdXJsCjM0NywsInByb2R1Y3QgbmFtZSIsLDEyMywxLCwsLCJjYXRlZ29yeSBuYW1lOyIsCg==',
14
site_id: 11111,
15
file_type: 'csv',
16
});
Copied!
Last modified 3mo ago