Работа с заявками
Работа с заявками. Получить, создать или удалить заявку. Как обновить статус заявки — всё это можно узнать на нашем сайте
Работа с заявками из корзины
Список заявок
GET
https://api.lpmotor.ru/v1/lead
Получение списка заявок по фильтрам
Query Parameters
Headers
{
"count": 0,
"sum": 0,
"limit": 0,
"offset": 0,
"leads": [
{
"id": 0,
"page_id": 0,
"name": "string",
"phone": "string",
"email": "string",
"ip": "string",
"ip_banned": 0,
"is_del": 0,
"type_id": 0,
"status_id": 0,
"f_expense": 0,
"f_profit": 0,
"kanban_position": 0,
"d_created": "string",
"page": {
"id": 0,
"user_id": 0,
"name": "string",
"url": "string",
"site_id": 0,
"is_enabled": true,
"d_last_change": "string",
"site": {
"id": int,
"title": "string",
"subdomain": "string",
"attached_domain": "string",
"is_del": false
},
"is_base_variant": false,
"is_variant": false,
"variant_name": "string"
},
"cart": null,
"total_price": 0
}
]
}
Пример запроса
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/lead?d_create_start=2020-08-09+00:00:00%2B05:00&sort_field[]=dCreated&sort_dir[]=ASC&status_id[]=1&limit=18&offset=0"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/lead';
$params = [
'd_create_start' => '2021-02-16T09:25:43+00:00',
'd_create_end' => '2021-03-16T09:25:43+00:00',
'status_id' => [1],
'type_id' => [1],
];
$url .= '?' . http_build_query($params);
curl_setopt($ch, CURLOPT_URL, $url);
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);
$responseData = json_decode($result, true);
curl_close($ch);
<?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/lead',
[
'query' => [
'd_create_start' => '2021-02-16T09:25:43+00:00',
'd_create_end' => '2021-03-16T09:25:43+00:00',
'status_id' => [1],
'type_id' => [1],
]
]
);
$statusCode = $response->getStatusCode();
$responseData = json_decode((string)$response->getBody(), true);
http = Axios.create({
baseURL: "https://api.lpmotor.ru",
timeout: 30000,
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/lead", {
params: data
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Получить заявку
GET
https://api.lpmotor.ru/v1/lead/{lead_id}
Path Parameters
Headers
{
"id": int,
"page_id": int,
"name": "string",
"phone": "string",
"email": null,
"ip": "string",
"ip_banned": 0,
"is_del": 0,
"type_id": 2,
"status_id": 1,
"f_expense": 0,
"f_profit": 0,
"kanban_position": 0,
"status": {
"id": 1,
"class": "new"
},
"type": {
"id": 2,
"class": "order"
},
"d_created": "string",
"history": [
{
"id": 0,
"typeId": null,
"statusId": null,
"message": "string",
"d_created": "string"
}
],
"page": {
"id": 0,
"user_id": 0,
"name": "string",
"url": "string",
"site_id": 0,
"is_enabled": false,
"d_last_change": "string",
"site": {
"id": 0,
"title": "string",
"subdomain": "string",
"attached_domain": "string",
"is_del": false
},
"is_base_variant": false,
"is_variant": false,
"variant_name": "string"
},
"cart": null,
"total_price": 234
}
Пример запроса
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/lead/<<lead_id>>"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/lead/' . $leadId;
curl_setopt($ch, CURLOPT_URL, $url);
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);
$responseData = json_decode($result, true);
curl_close($ch);
<?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/lead/' . $leadId);
$statusCode = $response->getStatusCode();
$responseData = json_decode((string)$response->getBody(), true);
http = Axios.create({
baseURL: "https://api.lpmotor.ru",
timeout: 30000,
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/lead/" + leadId)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Создать заявку
POST
https://api.lpmotor.ru/v1/lead
Headers
Request Body
{
"id": int,
"page_id": int,
"name": "string",
"phone": "string",
"email": null,
"ip": "string",
"ip_banned": 0,
"is_del": 0,
"type_id": 2,
"status_id": 1,
"f_expense": 0,
"f_profit": 0,
"kanban_position": 0,
"status": {
"id": 1,
"class": "new"
},
"type": {
"id": 2,
"class": "order"
},
"d_created": "string",
"history": [
{
"id": 0,
"typeId": null,
"statusId": null,
"message": "string",
"d_created": "string"
}
],
"page": {
"id": 0,
"user_id": 0,
"name": "string",
"url": "string",
"site_id": 0,
"is_enabled": false,
"d_last_change": "string",
"site": {
"id": 0,
"title": "string",
"subdomain": "string",
"attached_domain": "string",
"is_del": false
},
"is_base_variant": false,
"is_variant": false,
"variant_name": "string"
},
"cart": null,
"total_price": 234
}
Пример запроса
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/lead" \
-d "{page_id: <<page_id>>, status_id: <<status_id>>, type_id: <<type_id>>}"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/lead';
$data = [
'page_id' => $pageId,
'status_id' => $statusId,
'type_id' => $typeId,
];
curl_setopt($ch, CURLOPT_URL, $url);
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_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
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);
$responseData = json_decode($result, true);
curl_close($ch);
<?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,
],
]);
$data = [
'page_id' => $pageId,
'status_id' => $statusId,
'type_id' => $type_id,
];
$response = $client->post(
'/v1/lead',
[
'json' => $data,
]
);
$statusCode = $response->getStatusCode();
$responseData = json_decode((string)$response->getBody(), true);
http = Axios.create({
baseURL: "https://api.lpmotor.ru",
timeout: 30000,
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/lead", {
page_id : pageId,
status_id: statusId,
type_id : typeId
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Обновить статус заявки
PATCH
https://api.lpmotor.ru/v1/lead/{lead_id}
Path Parameters
Headers
Request Body
{
"id": 0,
"page_id": 0,
"name": "string",
"phone": "string",
"email": "string",
"ip": "string",
"ip_banned": 0,
"is_del": 0,
"type_id": 0,
"status_id": 0,
"f_expense": 0,
"f_profit": 0,
"kanban_position": 0,
"d_created": "string",
"page": {
"id": 0,
"user_id": 0,
"name": "string",
"url": "string",
"site_id": 0,
"is_enabled": true,
"d_last_change": "string",
"site": {
"id": int,
"title": "string",
"subdomain": "string",
"attached_domain": "string",
"is_del": false
},
"is_base_variant": false,
"is_variant": false,
"variant_name": "string"
},
"cart": null,
"total_price": 0
}
Пример запроса
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 PATCH "https://api.lpmotor.ru/v1/lead/<<lead_id>>" \
-d "{status_id: <<status_id>>}"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/lead/' . $leadId;
$data = ['status_id' => $statusId];
curl_setopt($ch, CURLOPT_URL, $url);
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_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
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);
$responseData = json_decode($result, true);
curl_close($ch);
<?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,
],
]);
$data = ['status_id' => $statusId];
$response = $client->patch(
'/v1/lead/' . $leadId,
[
'json' => $data,
]
);
$statusCode = $response->getStatusCode();
$responseData = json_decode((string)$response->getBody(), true);
http = Axios.create({
baseURL: "https://api.lpmotor.ru",
timeout: 30000,
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.patch("/v1/lead/" + leadId, {status_id: statusId})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Удалить заявку
DELETE
https://api.lpmotor.ru/v1/lead/{lead_id}
Path Parameters
Headers
Пример запроса
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/lead/<<lead_id>>"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/lead/' . $leadId;
curl_setopt($ch, CURLOPT_URL, $url);
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_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
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);
curl_close($ch);
<?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/lead/' . $leadId);
$statusCode = $response->getStatusCode();
http = Axios.create({
baseURL: "https://api.lpmotor.ru",
timeout: 30000,
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/lead/" + leadId)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Last updated