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

Информация о товаре

Метод API, по которому можно получить подробную информацию о товаре

Инфорация о товаре

Описание

GET https://api.lpmotor.ru/v1/shop/product/{product_id}

Path Parameters

Name
Type
Description

product_id*

integer

ID товара

Headers

Name
Type
Description

Authorization*

string

API токен

X-Api-User-Id*

integer

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

{
  "id": 0,
  "sku": "string",
  "name": "string",
  "description": "string",
  "price": 0,
  "is_visible": true,
  "quantity": 0,
  "weight": 0,
  "length": 0,
  "width": 0,
  "height": 0,
  "categories": [
    {
      "id": 0
    }
  ],
  "param_group_id": 0,
  "variants": [
    null
  ],
  "parent_id": 0,
  "old_price": 0,
  "short_description": "string",
  "description_url": "string",
  "image_list": [
    {
      "id": 0,
      "url": "string",
      "status_id": 0
    }
  ],
  "params": [
    {
      "id": 0,
      "type_id": 0,
      "name": "string",
      "unit": "string",
      "is_visible": true,
      "values": [
        {
          "id": 0,
          "label": "string",
          "value": "string",
          "is_visible": true,
          "image_status_id": 0,
          "image_url": "string"
        }
      ]
    }
  ],
  "modifiers": [
    {
      "id": 0,
      "type": 0,
      "name": "string",
      "price": "string",
      "max_count": 0,
      "default": true,
      "image": {
        "id": 0,
        "url": "string",
        "status_id": 0
      },
      "is_visible": true,
      "extra": [
        null
      ]
    }
  ]
}

Примеры

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/shop/product/12345" 
<?php
$ch = curl_init();

$productId = 12345;
curl_setopt($ch, CURLOPT_URL, 'https://api.lpmotor.ru/v1/shop/product/'. $productId);
curl_setopt(
    $ch,
    CURLOPT_HTTPHEADER,
    [
        'Host: api.lpmotor.ru',
        '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);
$bodyArray = json_decode($result, true);
<?php
$productId = 12345;
$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/shop/product/' . $productId
);
$statusCode = $response->getStatusCode();
$products = 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/shop/product/" + productId);
PreviousЭкспортNextСоздать товар

Last updated 2 years ago