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

Сайты

Поиск сайтов и список страниц сайта с примерами запросов

Работа с сайтами

Поиск сайтов

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

Поиск пользовательских сайтов и выданных по доступу.

Query Parameters

Name
Type
Description

offset

integer

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

limit

integer

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

sort_field

string

Сортировка сайтов по свойствам. Доступные значения: site_name, id, d_last_change. По умолчанию - id

sort_dir

string

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

type

string

Фильтр по типу сайта. Доступные значения: published, draft, accessible, own, all. По умолчанию - all

search_text

string

Поиск по имени сайта или домену

Headers

Name
Type
Description

X-Api-User-Id

integer

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

Authorization

string

API-токен

{
  "count": 0,
  "limit": 0,
  "offset": 0,
  "sites": [
    {
      "id": 0,
      "user_id": 0,
      "home_id": 0,
      "title": "string",
      "subdomain": "string",
      "attached_domain": "string",
      "d_created": "2021-08-04T15:28:46.655Z",
      "d_updated": "2021-08-04T15:28:46.655Z",
      "pages_is_signed": 0,
      "d_sign_off_expire": null,
      "is_del": false,
      "d_del": null,
      "home": {
        "id": 0,
        "user_id": 0,
        "name": "string",
        "url": "string",
        "site_id": 0,
        "is_enabled": false,
        "d_last_change": "2021-08-04T15:28:46.655Z",
        "access_count": 0,
        "is_base_variant": false,
        "is_variant": false,
        "variant_name": "string",
        "access_type": ["self"],
        "base_id": 0
      },
      "leads_count_new": 0,
      "https": false,
      "domain": "string",
      "domain_decoded": "string",
      "preview_image": "string",
      "project_id_list": [0,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/site?type=all&sort_field=id&sort_dir=DESC&limit=18&offset=0"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/site';
$param = ['type' => 'all'];
$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);
$siteList = 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/site',
    [
        'query' => [
            'type' => 'all',
        ]
    ]
);
$statusCode = $response->getStatusCode();
$siteList = 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/site", {
    params: data
})
.then(function (response) {
    console.log(response);
})
.catch(function (error) {
    console.log(error);
});

Список страниц сайта

GET https://api.lpmotor.ru/v1/site/{site_id}/page

Поиск страниц определенного сайта

Path Parameters

Name
Type
Description

site_id

integer

ID сайта

Query Parameters

Name
Type
Description

limit

integer

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

offset

integer

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

with_variants

integer

Отдавать страницы вместе с вариантами страниц. Доступные значения - 0,1. По умолчанию - 0

Headers

Name
Type
Description

X-Api-User-Id

string

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 GET "https://api.lpmotor.ru/v1/site/<<site_id>>/page?limit=18&offset=0&with_variants=0"
<?php
$ch = curl_init();
$url = 'https://api.lpmotor.ru/v1/site/' . $siteId . '/page';
$param = ['with_variants' => 0];
$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);
$siteList = 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/site',
    [
        'query' => [
            'with_variants' => 0,
        ]
    ]
);
$statusCode = $response->getStatusCode();
$siteList = 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/site/" + siteId + "/page", {
    params: data
})
.then(function (response) {
    console.log(response);
})
.catch(function (error) {
    console.log(error);
});
PreviousОграниченияNextЗаявки

Last updated 2 years ago