Конкуренты

Работа с карточками конкурентов для моделей товаров

Базовый URL: https://api.selsup.ru

🔗 Редактировать карточку конкурента

Редактировать карточку конкурента по его id
PUT /api/competitor/{competitorId}

Параметры пути PATH

Название Тип Обязательный Описание
competitorId integer Да Параметр competitorId

Тело запроса *Обязательно

Content-Type: application/json
ПолеТипОписание
modelId integer ID модели, для которой указывается конкурент
service Обязательный string Сервис
url Обязательный string URL карточки конкурента на маркетплейсе
serviceId string ID карточки конкурента на сайте маркетплейса

Тело ответа

✓ 200 OK
⚠ 400 Ошибка с данными запроса
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
localMessage Обязательный string Текст ошибки на языке пользователя
params object Дополнительные параметры ошибки
⚠ 403 Доступ запрещен
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
✗ 500 Внутренняя ошибка сервера
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
message string Описание ошибки
system string Системная ошибки парсинга данных запроса
Укажите ключ API в правом верхнем углу, чтобы попробовать использовать метод

Примеры кода

const axios = require('axios');

const response = await axios.put('https://api.selsup.ru/api/competitor/${competitorId}',
  {
    "id": "Иванович",
    "modelId": 123,
    "service": "NONE",
    "url": "https://example.com/resource",
    "serviceId": "Пример serviceId",
    "clientId": 123
  },
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import axios from 'axios';

const response = await axios.put<any>('https://api.selsup.ru/api/competitor/${competitorId}',
  {
    "id": "Иванович",
    "modelId": 123,
    "service": "NONE",
    "url": "https://example.com/resource",
    "serviceId": "Пример serviceId",
    "clientId": 123
  },
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import requests

headers = {
    'Authorization': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

response = requests.put(
    'https://api.selsup.ru/api/competitor/${competitorId}',
    headers=headers,
    json={
    'id': 'Иванович',
    'modelId': 123,
    'service': 'NONE',
    'url': 'https://example.com/resource',
    'serviceId': 'Пример serviceId',
    'clientId': 123
}
)

print(response.json())
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    client := &http.Client{}

    payload := map[string]interface{}{
        `id`: `Иванович`,
        `modelId`: 123,
        `service`: `NONE`,
        `url`: `https://example.com/resource`,
        `serviceId`: `Пример serviceId`,
        `clientId`: 123
}
    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("put", "https://api.selsup.ru/api/competitor/${competitorId}", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    fmt.Println(result)
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.selsup.ru/api/competitor/${competitorId}"))
    .header("Authorization", "YOUR_API_KEY")
    .header("Content-Type", "application/json")
    .put(HttpRequest.BodyPublishers.ofString(
        "{\"id\":\"Иванович\",\"modelId\":123,\"service\":\"NONE\",\"url\":\"https://example.com/resource\",\"serviceId\":\"Пример serviceId\",\"clientId\":123}"
    ))
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.selsup.ru/api/competitor/${competitorId}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'put',
    CURLOPT_POSTFIELDS => json_encode({
    'id': 'Иванович',
    'modelId': 123,
    'service': 'NONE',
    'url': 'https://example.com/resource',
    'serviceId': 'Пример serviceId',
    'clientId': 123
}),
    CURLOPT_HTTPHEADER => [
        'Authorization: YOUR_API_KEY',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
?>
curl -X put \
  'https://api.selsup.ru/api/competitor/{competitorId}' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "Иванович",
  "modelId": 123,
  "service": "NONE",
  "url": "https://example.com/resource",
  "serviceId": "Пример serviceId",
  "clientId": 123
}'

🔗 Удалить карточку конкурента

Удалить карточку конкурента по его id
DELETE /api/competitor/{competitorId}

Параметры пути PATH

Название Тип Обязательный Описание
competitorId integer Да Параметр competitorId

Тело ответа

✓ 200 OK
⚠ 400 Ошибка с данными запроса
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
localMessage Обязательный string Текст ошибки на языке пользователя
params object Дополнительные параметры ошибки
⚠ 403 Доступ запрещен
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
✗ 500 Внутренняя ошибка сервера
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
message string Описание ошибки
system string Системная ошибки парсинга данных запроса
Укажите ключ API в правом верхнем углу, чтобы попробовать использовать метод

Примеры кода

const axios = require('axios');

const response = await axios.delete('https://api.selsup.ru/api/competitor/${competitorId}',
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import axios from 'axios';

const response = await axios.delete<any>('https://api.selsup.ru/api/competitor/${competitorId}',
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import requests

headers = {
    'Authorization': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

response = requests.delete(
    'https://api.selsup.ru/api/competitor/${competitorId}',
    headers=headers
)

print(response.json())
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    client := &http.Client{}

    req, _ := http.NewRequest("delete", "https://api.selsup.ru/api/competitor/${competitorId}", nil)
    req.Header.Set("Authorization", "YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    fmt.Println(result)
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.selsup.ru/api/competitor/${competitorId}"))
    .header("Authorization", "YOUR_API_KEY")
    .header("Content-Type", "application/json")
    .delete(HttpRequest.BodyPublishers.noBody())
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.selsup.ru/api/competitor/${competitorId}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'delete',
    CURLOPT_HTTPHEADER => [
        'Authorization: YOUR_API_KEY',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
?>
curl -X delete \
  'https://api.selsup.ru/api/competitor/{competitorId}' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: application/json'

🔗 Получить список всех конкурентов для модели

Получить список всех конкурентов для модели по ее id
GET /api/competitor/{modelId}

Параметры пути PATH

Название Тип Обязательный Описание
modelId integer Да Параметр modelId

Тело ответа

✓ 200 OK
Content-Type: application/json
Тип ответа: Competitor Карточка конкурента для модели товара
Элементы массива
Поле Тип Описание
id integer Нет ID конкурента
modelId integer Нет ID модели, для которой указывается конкурент
service string Нет Сервис
url string Нет URL карточки конкурента на маркетплейсе
serviceId string Нет ID карточки конкурента на сайте маркетплейса
clientId integer Нет ID клиента
⚠ 400 Ошибка с данными запроса
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
localMessage Обязательный string Текст ошибки на языке пользователя
params object Дополнительные параметры ошибки
⚠ 403 Доступ запрещен
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
✗ 500 Внутренняя ошибка сервера
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
message string Описание ошибки
system string Системная ошибки парсинга данных запроса
Укажите ключ API в правом верхнем углу, чтобы попробовать использовать метод

Примеры кода

const axios = require('axios');

const response = await axios.get('https://api.selsup.ru/api/competitor/${modelId}',
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import axios from 'axios';

const response = await axios.get<any>('https://api.selsup.ru/api/competitor/${modelId}',
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import requests

headers = {
    'Authorization': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

response = requests.get(
    'https://api.selsup.ru/api/competitor/${modelId}',
    headers=headers
)

print(response.json())
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    client := &http.Client{}

    req, _ := http.NewRequest("get", "https://api.selsup.ru/api/competitor/${modelId}", nil)
    req.Header.Set("Authorization", "YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    fmt.Println(result)
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.selsup.ru/api/competitor/${modelId}"))
    .header("Authorization", "YOUR_API_KEY")
    .header("Content-Type", "application/json")
    .get(HttpRequest.BodyPublishers.noBody())
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.selsup.ru/api/competitor/${modelId}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'get',
    CURLOPT_HTTPHEADER => [
        'Authorization: YOUR_API_KEY',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
?>
curl -X get \
  'https://api.selsup.ru/api/competitor/{modelId}' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: application/json'

🔗 Создать связь с карточкой конкурента

Создать модель конкурента, связывая его с карточкой конкурента
POST /api/competitor/{modelId}

Параметры пути PATH

Название Тип Обязательный Описание
modelId integer Да Параметр modelId

Тело запроса *Обязательно

Content-Type: application/json
ПолеТипОписание
modelId integer ID модели, для которой указывается конкурент
service Обязательный string Сервис
url Обязательный string URL карточки конкурента на маркетплейсе
serviceId string ID карточки конкурента на сайте маркетплейса

Тело ответа

✓ 200 OK
Content-Type: application/json
Поле Тип Описание
id integer ID конкурента
modelId integer ID модели, для которой указывается конкурент
service string Сервис
url string URL карточки конкурента на маркетплейсе
serviceId string ID карточки конкурента на сайте маркетплейса
clientId integer ID клиента
⚠ 400 Ошибка с данными запроса
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
localMessage Обязательный string Текст ошибки на языке пользователя
params object Дополнительные параметры ошибки
⚠ 403 Доступ запрещен
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
✗ 500 Внутренняя ошибка сервера
Content-Type: application/json
Поле Тип Описание
error Обязательный string Код ошибки
message string Описание ошибки
system string Системная ошибки парсинга данных запроса
Укажите ключ API в правом верхнем углу, чтобы попробовать использовать метод

Примеры кода

const axios = require('axios');

const response = await axios.post('https://api.selsup.ru/api/competitor/${modelId}',
  {
    "id": "Иванович",
    "modelId": 123,
    "service": "NONE",
    "url": "https://example.com/resource",
    "serviceId": "Пример serviceId",
    "clientId": 123
  },
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import axios from 'axios';

const response = await axios.post<any>('https://api.selsup.ru/api/competitor/${modelId}',
  {
    "id": "Иванович",
    "modelId": 123,
    "service": "NONE",
    "url": "https://example.com/resource",
    "serviceId": "Пример serviceId",
    "clientId": 123
  },
  {
    headers: {
      'Authorization': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  }
);

console.log(response.data);
import requests

headers = {
    'Authorization': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

response = requests.post(
    'https://api.selsup.ru/api/competitor/${modelId}',
    headers=headers,
    json={
    'id': 'Иванович',
    'modelId': 123,
    'service': 'NONE',
    'url': 'https://example.com/resource',
    'serviceId': 'Пример serviceId',
    'clientId': 123
}
)

print(response.json())
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    client := &http.Client{}

    payload := map[string]interface{}{
        `id`: `Иванович`,
        `modelId`: 123,
        `service`: `NONE`,
        `url`: `https://example.com/resource`,
        `serviceId`: `Пример serviceId`,
        `clientId`: 123
}
    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("post", "https://api.selsup.ru/api/competitor/${modelId}", bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    fmt.Println(result)
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.selsup.ru/api/competitor/${modelId}"))
    .header("Authorization", "YOUR_API_KEY")
    .header("Content-Type", "application/json")
    .post(HttpRequest.BodyPublishers.ofString(
        "{\"id\":\"Иванович\",\"modelId\":123,\"service\":\"NONE\",\"url\":\"https://example.com/resource\",\"serviceId\":\"Пример serviceId\",\"clientId\":123}"
    ))
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.selsup.ru/api/competitor/${modelId}',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'post',
    CURLOPT_POSTFIELDS => json_encode({
    'id': 'Иванович',
    'modelId': 123,
    'service': 'NONE',
    'url': 'https://example.com/resource',
    'serviceId': 'Пример serviceId',
    'clientId': 123
}),
    CURLOPT_HTTPHEADER => [
        'Authorization: YOUR_API_KEY',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
?>
curl -X post \
  'https://api.selsup.ru/api/competitor/{modelId}' \
  -H 'Authorization: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "Иванович",
  "modelId": 123,
  "service": "NONE",
  "url": "https://example.com/resource",
  "serviceId": "Пример serviceId",
  "clientId": 123
}'