Mottor API
Search
K

Доставки

Получение списка доставок. Как создать, изменить или удалить доставки. Всё покажем с примерами на нашем сайте

Работа с доставками

get
https://api.lpmotor.ru
/v1/delivery/site/{site_id}
Получение списка доставок

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

CURL
PHP CURL
PHP Guzzle
JavaScript
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/delivery/site/11111"
<?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/delivery/site/' . $siteId
);
$statusCode = $response->getStatusCode();
$deliveries = json_decode((string) $response->getBody(), true);
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/delivery/site/" + siteId);
post
https://api.lpmotor.ru
/v1/delivery
Создание доставки

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

CURL
PHP CURL
PHP Guzzle
JavaScript
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 POST "https://api.lpmotor.ru/v1/delivery" \
-d '{"template_id":2,"title":"delivery name","site_id":11111,"enabled":true,"regions":[],"points":[{"title":"test point","comment":"this is comment","enabled":true}],"additional_fields":[{"id":1},{"id":2}]}'
<?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->post(
'/v1/delivery',
[
'json' => [
'template_id' => 2,
'site_id' => $siteId,
'title' => 'my delivery',
'enabled' => true,
'regions' => [],
'points' => [
[
'title' => 'test point',
'comment' => 'this is comment',
'enabled' => true
],
],
'additional_fields' => [
['id' => 1],
['id' => 2],
],
],
]
);
$statusCode = $response->getStatusCode();
$delivery = json_decode((string) $response->getBody(), true);
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.post('/v1/delivery', {
"template_id": 1,
"title": "delivery name",
"site_id": 11111,
"enabled": true,
"regions": [],
"points": [
{
"title": "test point",
"comment": "this is comment",
"enabled": true
}
],
"additional_fields": [
{
"id": 1
},
{
"id": 2
}
]
});
get
https://api.lpmotor.ru
/v1/delivery/{delivery_id}
Получение доставки по ID

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

CURL
PHP CURL
PHP Guzzle
JavaScript
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/delivery/1"
<?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/delivery/' . $deliveryId
);
$statusCode = $response->getStatusCode();
$delivery = json_decode((string) $response->getBody(), true);
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/delivery/" + deliveryId);
put
https://api.lpmotor.ru
/v1/delivery
Изменение доставки

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

CURL
PHP CURL
PHP Guzzle
JavaScript
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 PUT "https://api.lpmotor.ru/v1/delivery" \
-d '{"id":1,"title":"new delivery name","enabled":false,"pos":1,"points":[],"regions":[{"id":1,"title":"new region name","enabled":true}]}'
<?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->put(
'/v1/delivery',
[
'json' => [
'id' => 1,
'title' => 'my delivery',
'enabled' => true,
'pos' => 1,
'regions' => [
[
'id' => 1,
'title' => 'test point',
'comment' => 'this is comment',
'enabled' => true
],
],
],
]
);
$statusCode = $response->getStatusCode();
$delivery = json_decode((string) $response->getBody(), true);
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.put('/v1/delivery', {
"id": 1,
"title": "delivery name",
"pos": 1,
"enabled": true,
"regions": [
{
"id": 1,
"title": "test point",
"comment": "this is comment",
"enabled": true
}
],
});
delete
https://api.lpmotor.ru
/v1/delivery/{delivery_id}
Удаление доставки

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

CURL
PHP CURL
PHP Guzzle
JavaScript
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 DELETE "https://api.lpmotor.ru/v1/delivery/1"
<?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->delete(
'/v1/delivery/1'
);
$statusCode = $response->getStatusCode();
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.delete("/v1/delivery/1");