Mottor API
Search
K

Сайты

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

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

get
https://api.lpmotor.ru
/v1/site
Поиск сайтов

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

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/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
Список страниц сайта

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

CURL
PHP CURL
PHP Guzzle
Javascsript
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);
});