Mottor API
  • Введение
  • Авторизация
  • Ограничения
  • Методы
  • Сайты
  • Заявки
    • Работа с заявками
    • Товары из корзины
  • Товары
    • Импорт
    • Экспорт
    • Информация о товаре
    • Создать товар
  • Доставки
  • Промокоды
  • Дополнительно
    • Ошибки
Powered by GitBook
On this page
  • Работа с заявками из корзины
  • Список заявок
  • Получить заявку
  • Создать заявку
  • Обновить статус заявки
  • Удалить заявку
  1. Заявки

Работа с заявками

Работа с заявками. Получить, создать или удалить заявку. Как обновить статус заявки — всё это можно узнать на нашем сайте

Работа с заявками из корзины

Список заявок

GET https://api.lpmotor.ru/v1/lead

Получение списка заявок по фильтрам

Query Parameters

Name
Type
Description

offset

string

С какого по счету элемента выдавать список. По умолчанию - 0

limit

string

Лимит выдаваемых сайтов. По умолчанию - 18

sort_field

string

Тип сортировки поля. По умолчанию - id

sort_dir

string

Сортировка по возрастанию или убыванию. Доступные значения - DESC,ASC. По умолчанию - DESC

type_id

array

Выбор типа заявки для показа. Список типов в таблице. По умолчанию показываются все типы

status_id

array

Статус заявки. Список статусов в таблице ниже. По умолчанию показываются заявки со всеми статусами.

page_id

string

ID страницы

site_id

string

ID сайта

d_create_start

string

Время создания заявки в формате ISO8601.

d_create_end

string

Время создания заявки в формате ISO8601.

search_text

string

Произвольный текст. ищет совпадения в имени, email и номере телефоне.

Headers

Name
Type
Description

X-Api-User-Id

integer

ID пользователя

Authorization

string

API-токен

{
  "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

Name
Type
Description

lead_id

integer

ID заявки

Headers

Name
Type
Description

X-Api-User-Id

integer

ID пользователя

Authorization

string

API-токен

{
  "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

Name
Type
Description

X-Api-User-Id

integer

ID пользователя

Authorization

string

API-токен

Request Body

Name
Type
Description

page_id

string

ID страницы

status_id

string

ID статуса заявки

type_id

string

ID типа заявки

ip

string

IP пользователя

name

string

Имя пользователя

email

string

Email пользователя

phone

string

Телефон пользователя

comment

string

Комментарий к заявке

f_income

string

Сумма сделки

{
  "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}/status

Path Parameters

Name
Type
Description

lead_id

integer

ID заявки

Headers

Name
Type
Description

X-Api-User-Id

integer

ID пользователя

Authorization

string

API-токен

Request Body

Name
Type
Description

status_id

integer

ID нового статуса заявки

{
  "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>>/status" \
-d "{status_id: <<status_id>>}"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/lead/' . $leadId. '/status';
$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 . '/status',
    [
        '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", {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

Name
Type
Description

lead_id

integer

ID удаляемой заявки

Headers

Name
Type
Description

X-Api-User-Id

integer

ID пользователя

Authorization

string

API-токен

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

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);
});
PreviousЗаявкиNextТовары из корзины

Last updated 11 months ago