通过可编辑的独立合同来支持本页面. 在生产使用之前,验证使用测试数据的写作操作.
/api/competitor
准备使用的工作流程
准备使用的工作流程
数据模型
数据结构
模型在此列出一次,并且可以直接从使用它们的终端点扩展.
Competitor6 字段
idinteger · int64Id.
read-onlymodelIdinteger · int64模型身份证.
servicestring服务.
必填urlstring查看一个URL.
必填serviceIdstring服务身份证.
clientIdinteger · int64客户身份证.
read-only错误合同
如何返回应用错误
编程的代码在每个地方都相同,而用户面向的消息由服务器翻译. 建立在error周围的应用逻辑,仅用于显示.
鱼类稳定机器可读的代码用于集成逻辑.
鱼类在API代币用户语言中显示准备的消息.
鱼类服务器在本地化消息模板中插入的值.
localMessage使用了 API代币的用户的lang字段.文档语言和 Accept-Language标题不会改变它;当用户没有语言配置时,使用俄语.
{
"error": "error_brand_already_exists",
"localMessage": "Бренд Base уже существует",
"params": {
"name": "Base"
}
}{
"error": "error_brand_already_exists",
"localMessage": "品牌 Base 已经存在",
"params": {
"name": "Base"
}
}终点
终点
更新
/api/competitor/{competitorId}使用 PUT 更新
路径参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
competitorId |
integer · int64 | 是 | 竞争对手的身份. |
要求机构
application/json对象场Competitor
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
id |
integer · int64 | 否 | Id. |
modelId |
integer · int64 | 否 | 模型身份证. |
service |
stringNONE, WILDBERRIES, OZON, YANDEX_MARKET, FAMILIYA, NATIONAL_CATALOG, ALIEXPRESS, OTHER, MOY_SKLAD, SBER_MEGA_MARKET, CISLINK, ONE_C, AVITO, LEROY_MERLIN, DETMIR, KAZAN_EXPRESS, EVOTOR, WEBASYST, AMAZON, EBAY, SIMALAND, INSALES, LAMODA, OZON_PERFORMANCE, WALMART, GOOGLE, YANDEX_DISC, EMAIL, WOOCOMMERCE, MAGNIT, OPENCART, M_VIDEO, TAKEALOT, UZUM, SHOPIFY, MAKRO, YANDEX_KIT, BOB_SHOP, KASPI, DIADOC | 是 | 服务. |
url |
string | 是 | 查看一个URL. |
serviceId |
string | 否 | 服务身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
curl --request PUT 'https://api.selsup.ru/api/competitor/1001' \
--header 'Authorization: YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}'
const response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'PUT',
headers: {
Authorization: process.env.SELSUP_API_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}),
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'selsup_request_failed');
}
const response: Response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'PUT',
headers: {
Authorization: process.env.SELSUP_API_TOKEN!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}),
});
if (!response.ok) {
const error = await response.json() as { error?: string };
throw new Error(error.error ?? 'selsup_request_failed');
}
import os
import requests
response = requests.put(
'https://api.selsup.ru/api/competitor/1001',
headers={'Authorization': os.environ['SELSUP_API_TOKEN']},
json={
'service': 'NONE',
'url': 'https://example.com',
'id': 1001,
'modelId': 1001,
'serviceId': 'string',
'clientId': 1001
},
)
response.raise_for_status()
<?php
$payload = <<<'JSON'
{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}
JSON;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.selsup.ru/api/competitor/1001',
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: ' . getenv('SELSUP_API_TOKEN'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($response === false || $status >= 400) {
throw new RuntimeException($response ?: 'selsup_request_failed');
}
echo $response;
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
req, err := http.NewRequest("PUT", "https://api.selsup.ru/api/competitor/1001", strings.NewReader(`{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}`))
if err != nil { panic(err) }
req.Header.Set("Authorization", os.Getenv("SELSUP_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
response, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer response.Body.Close()
result, _ := io.ReadAll(response.Body)
fmt.Printf("%d\n%s\n", response.StatusCode, result)
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class SelSupExample {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.selsup.ru/api/competitor/1001"))
.header("Authorization", System.getenv("SELSUP_API_TOKEN"))
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("""
{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}
"""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
成功的反应
200答案没有身体.
错误8
应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_competitor_id_required应用逻辑中使用稳定的error_competitor_id_required代码;localMessage包含上述翻译.
error_competitor_required应用逻辑中使用稳定的error_competitor_required代码;localMessage包含上述翻译.
error_competitor_service_required应用逻辑中使用稳定的error_competitor_service_required代码;localMessage包含上述翻译.
error_competitor_url_required应用逻辑中使用稳定的error_competitor_url_required代码;localMessage包含上述翻译.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.
删除
/api/competitor/{competitorId}使用 DELETE /api/competitor/{competitorId}.删除
路径参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
competitorId |
integer · int64 | 是 | 竞争对手的身份. |
curl --request DELETE 'https://api.selsup.ru/api/competitor/1001' \
--header 'Authorization: YOUR_API_TOKEN'
const response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'DELETE',
headers: { Authorization: process.env.SELSUP_API_TOKEN },
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'selsup_request_failed');
}
const response: Response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'DELETE',
headers: { Authorization: process.env.SELSUP_API_TOKEN! },
});
if (!response.ok) {
const error = await response.json() as { error?: string };
throw new Error(error.error ?? 'selsup_request_failed');
}
import os
import requests
response = requests.delete(
'https://api.selsup.ru/api/competitor/1001',
headers={'Authorization': os.environ['SELSUP_API_TOKEN']},
)
response.raise_for_status()
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.selsup.ru/api/competitor/1001',
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: ' . getenv('SELSUP_API_TOKEN')],
]);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($response === false || $status >= 400) {
throw new RuntimeException($response ?: 'selsup_request_failed');
}
echo $response;
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("DELETE", "https://api.selsup.ru/api/competitor/1001", nil)
if err != nil { panic(err) }
req.Header.Set("Authorization", os.Getenv("SELSUP_API_TOKEN"))
response, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer response.Body.Close()
result, _ := io.ReadAll(response.Body)
fmt.Printf("%d\n%s\n", response.StatusCode, result)
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class SelSupExample {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.selsup.ru/api/competitor/1001"))
.header("Authorization", System.getenv("SELSUP_API_TOKEN"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
成功的反应
200答案没有身体.
错误5
应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_competitor_id_required应用逻辑中使用稳定的error_competitor_id_required代码;localMessage包含上述翻译.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.
拿起所有
/api/competitor/{modelId}使用GETX/api/competitor/{modelId}.获取所有内容
路径参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
modelId |
integer · int64 | 是 | 模型身份证. |
curl --request GET 'https://api.selsup.ru/api/competitor/1001' \
--header 'Authorization: YOUR_API_TOKEN'
const response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'GET',
headers: { Authorization: process.env.SELSUP_API_TOKEN },
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'selsup_request_failed');
}
const result = await response.json();
const response: Response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'GET',
headers: { Authorization: process.env.SELSUP_API_TOKEN! },
});
if (!response.ok) {
const error = await response.json() as { error?: string };
throw new Error(error.error ?? 'selsup_request_failed');
}
const result: unknown = await response.json();
import os
import requests
response = requests.get(
'https://api.selsup.ru/api/competitor/1001',
headers={'Authorization': os.environ['SELSUP_API_TOKEN']},
)
response.raise_for_status()
result = response.json()
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.selsup.ru/api/competitor/1001',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: ' . getenv('SELSUP_API_TOKEN')],
]);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($response === false || $status >= 400) {
throw new RuntimeException($response ?: 'selsup_request_failed');
}
echo $response;
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://api.selsup.ru/api/competitor/1001", nil)
if err != nil { panic(err) }
req.Header.Set("Authorization", os.Getenv("SELSUP_API_TOKEN"))
response, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer response.Body.Close()
result, _ := io.ReadAll(response.Body)
fmt.Printf("%d\n%s\n", response.StatusCode, result)
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class SelSupExample {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.selsup.ru/api/competitor/1001"))
.header("Authorization", System.getenv("SELSUP_API_TOKEN"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
成功的反应
200
阵列项结构
Competitor[]
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
id |
integer · int64 | 否 | Id. |
modelId |
integer · int64 | 否 | 模型身份证. |
service |
stringNONE, WILDBERRIES, OZON, YANDEX_MARKET, FAMILIYA, NATIONAL_CATALOG, ALIEXPRESS, OTHER, MOY_SKLAD, SBER_MEGA_MARKET, CISLINK, ONE_C, AVITO, LEROY_MERLIN, DETMIR, KAZAN_EXPRESS, EVOTOR, WEBASYST, AMAZON, EBAY, SIMALAND, INSALES, LAMODA, OZON_PERFORMANCE, WALMART, GOOGLE, YANDEX_DISC, EMAIL, WOOCOMMERCE, MAGNIT, OPENCART, M_VIDEO, TAKEALOT, UZUM, SHOPIFY, MAKRO, YANDEX_KIT, BOB_SHOP, KASPI, DIADOC | 是 | 服务. |
url |
string | 是 | 查看一个URL. |
serviceId |
string | 否 | 服务身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
[
"string"
]错误5
应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_model_id_required应用逻辑中使用稳定的error_model_id_required代码;localMessage包含上述翻译.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.
创建
/api/competitor/{modelId}使用 POST 创建 /api/competitor/{modelId}.
路径参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
modelId |
integer · int64 | 是 | 模型身份证. |
要求机构
application/json对象场Competitor
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
id |
integer · int64 | 否 | Id. |
modelId |
integer · int64 | 否 | 模型身份证. |
service |
stringNONE, WILDBERRIES, OZON, YANDEX_MARKET, FAMILIYA, NATIONAL_CATALOG, ALIEXPRESS, OTHER, MOY_SKLAD, SBER_MEGA_MARKET, CISLINK, ONE_C, AVITO, LEROY_MERLIN, DETMIR, KAZAN_EXPRESS, EVOTOR, WEBASYST, AMAZON, EBAY, SIMALAND, INSALES, LAMODA, OZON_PERFORMANCE, WALMART, GOOGLE, YANDEX_DISC, EMAIL, WOOCOMMERCE, MAGNIT, OPENCART, M_VIDEO, TAKEALOT, UZUM, SHOPIFY, MAKRO, YANDEX_KIT, BOB_SHOP, KASPI, DIADOC | 是 | 服务. |
url |
string | 是 | 查看一个URL. |
serviceId |
string | 否 | 服务身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
curl --request POST 'https://api.selsup.ru/api/competitor/1001' \
--header 'Authorization: YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}'
const response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'POST',
headers: {
Authorization: process.env.SELSUP_API_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}),
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'selsup_request_failed');
}
const result = await response.json();
const response: Response = await fetch('https://api.selsup.ru/api/competitor/1001', {
method: 'POST',
headers: {
Authorization: process.env.SELSUP_API_TOKEN!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}),
});
if (!response.ok) {
const error = await response.json() as { error?: string };
throw new Error(error.error ?? 'selsup_request_failed');
}
const result: unknown = await response.json();
import os
import requests
response = requests.post(
'https://api.selsup.ru/api/competitor/1001',
headers={'Authorization': os.environ['SELSUP_API_TOKEN']},
json={
'service': 'NONE',
'url': 'https://example.com',
'id': 1001,
'modelId': 1001,
'serviceId': 'string',
'clientId': 1001
},
)
response.raise_for_status()
result = response.json()
<?php
$payload = <<<'JSON'
{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}
JSON;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.selsup.ru/api/competitor/1001',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: ' . getenv('SELSUP_API_TOKEN'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($response === false || $status >= 400) {
throw new RuntimeException($response ?: 'selsup_request_failed');
}
echo $response;
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
req, err := http.NewRequest("POST", "https://api.selsup.ru/api/competitor/1001", strings.NewReader(`{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}`))
if err != nil { panic(err) }
req.Header.Set("Authorization", os.Getenv("SELSUP_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
response, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer response.Body.Close()
result, _ := io.ReadAll(response.Body)
fmt.Printf("%d\n%s\n", response.StatusCode, result)
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class SelSupExample {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.selsup.ru/api/competitor/1001"))
.header("Authorization", System.getenv("SELSUP_API_TOKEN"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}
"""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
成功的反应
200
对象场
Competitor
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
id |
integer · int64 | 否 | Id. |
modelId |
integer · int64 | 否 | 模型身份证. |
service |
stringNONE, WILDBERRIES, OZON, YANDEX_MARKET, FAMILIYA, NATIONAL_CATALOG, ALIEXPRESS, OTHER, MOY_SKLAD, SBER_MEGA_MARKET, CISLINK, ONE_C, AVITO, LEROY_MERLIN, DETMIR, KAZAN_EXPRESS, EVOTOR, WEBASYST, AMAZON, EBAY, SIMALAND, INSALES, LAMODA, OZON_PERFORMANCE, WALMART, GOOGLE, YANDEX_DISC, EMAIL, WOOCOMMERCE, MAGNIT, OPENCART, M_VIDEO, TAKEALOT, UZUM, SHOPIFY, MAKRO, YANDEX_KIT, BOB_SHOP, KASPI, DIADOC | 是 | 服务. |
url |
string | 是 | 查看一个URL. |
serviceId |
string | 否 | 服务身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
{
"service": "NONE",
"url": "https://example.com",
"id": 1001,
"modelId": 1001,
"serviceId": "string",
"clientId": 1001
}错误7
应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_competitor_required应用逻辑中使用稳定的error_competitor_required代码;localMessage包含上述翻译.
error_competitor_service_required应用逻辑中使用稳定的error_competitor_service_required代码;localMessage包含上述翻译.
error_competitor_url_required应用逻辑中使用稳定的error_competitor_url_required代码;localMessage包含上述翻译.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.