开始使用制造商
使用专用API代币,首先验证测试数据的读取操作.
- 保存代币服务器侧,然后将其发送到Authorization标题中.
- 检查所需参数,并扩大请求或响应方案.
- 在应用错误中处理HTTP状态和稳定的error字段.
通过可编辑的独立合同来支持本页面. 在生产使用之前,验证使用测试数据的写作操作.
/api/manufacturer
准备使用的工作流程
使用专用API代币,首先验证测试数据的读取操作.
数据模型
模型在此列出一次,并且可以直接从使用它们的终端点扩展.
manufacturerIdinteger · int32制造商身份
titlestring标题
namestring姓名.
必填addressstring现在,我有个地址.
organizationIdinteger · int64组织身份证.
clientIdinteger · int64客户身份证.
read-onlycountryIdinteger · int32国家的身份证.
countryNamestring国家的名称.
read-onlyinnstring酒店.
deletedboolean删除了.
oneCIdstring一个公告.
rowsManufacturer[]排列.
错误合同
编程的代码在每个地方都相同,而用户面向的消息由服务器翻译. 建立在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/manufacturer/{manufacturerId}使用 GET /api/manufacturer/{manufacturerId}.获取制造商身份
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 是 | 制造商身份 |
curl --request GET 'https://api.selsup.ru/api/manufacturer/1001' \
--header 'Authorization: YOUR_API_TOKEN'
const response = await fetch('https://api.selsup.ru/api/manufacturer/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/manufacturer/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/manufacturer/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/manufacturer/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/manufacturer/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/manufacturer/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());
}
}
Manufacturer
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 否 | 制造商身份 |
title |
string | 否 | 标题 |
name |
string | 是 | 姓名. |
address |
string | 否 | 现在,我有个地址. |
organizationId |
integer · int64 | 否 | 组织身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
countryId |
integer · int32 | 否 | 国家的身份证. |
countryName |
string | 否 | 国家的名称. |
inn |
string | 否 | 酒店. |
deleted |
boolean | 否 | 删除了. |
oneCId |
string | 否 | 一个公告. |
{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_manufacturer_not_found应用逻辑中使用稳定的error_manufacturer_not_found代码;localMessage包含上述翻译.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.
error_subscription_expired应用逻辑中使用稳定的error_subscription_expired代码;localMessage包含上述翻译.
/api/manufacturer/{manufacturerId}使用 PUT /api/manufacturer/{manufacturerId}. 更新制造商
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int64 | 是 | 制造商身份 |
application/jsonManufacturer| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 否 | 制造商身份 |
title |
string | 否 | 标题 |
name |
string | 是 | 姓名. |
address |
string | 否 | 现在,我有个地址. |
organizationId |
integer · int64 | 否 | 组织身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
countryId |
integer · int32 | 否 | 国家的身份证. |
countryName |
string | 否 | 国家的名称. |
inn |
string | 否 | 酒店. |
deleted |
boolean | 否 | 删除了. |
oneCId |
string | 否 | 一个公告. |
curl --request PUT 'https://api.selsup.ru/api/manufacturer/1001' \
--header 'Authorization: YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}'
const response = await fetch('https://api.selsup.ru/api/manufacturer/1001', {
method: 'PUT',
headers: {
Authorization: process.env.SELSUP_API_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"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/manufacturer/1001', {
method: 'PUT',
headers: {
Authorization: process.env.SELSUP_API_TOKEN!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"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.put(
'https://api.selsup.ru/api/manufacturer/1001',
headers={'Authorization': os.environ['SELSUP_API_TOKEN']},
json={
'name': 'Example',
'manufacturerId': 1001,
'title': 'Example',
'address': 'string',
'organizationId': 1001,
'clientId': 1001
},
)
response.raise_for_status()
result = response.json()
<?php
$payload = <<<'JSON'
{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}
JSON;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.selsup.ru/api/manufacturer/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/manufacturer/1001", strings.NewReader(`{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"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/manufacturer/1001"))
.header("Authorization", System.getenv("SELSUP_API_TOKEN"))
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("""
{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}
"""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
Manufacturer
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 否 | 制造商身份 |
title |
string | 否 | 标题 |
name |
string | 是 | 姓名. |
address |
string | 否 | 现在,我有个地址. |
organizationId |
integer · int64 | 否 | 组织身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
countryId |
integer · int32 | 否 | 国家的身份证. |
countryName |
string | 否 | 国家的名称. |
inn |
string | 否 | 酒店. |
deleted |
boolean | 否 | 删除了. |
oneCId |
string | 否 | 一个公告. |
{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_empty_manufacturer_name应用逻辑中使用稳定的error_empty_manufacturer_name代码;localMessage包含上述翻译.
error_manufacturer_already_exist应用逻辑中使用稳定的error_manufacturer_already_exist代码;localMessage包含上述翻译.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.
error_subscription_expired应用逻辑中使用稳定的error_subscription_expired代码;localMessage包含上述翻译.
/api/manufacturer/{manufacturerId}使用 DELETE /api/manufacturer/{manufacturerId}.的制造商删除
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 是 | 制造商身份 |
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
deleted |
boolean | 是 | 删除了. |
curl --request DELETE 'https://api.selsup.ru/api/manufacturer/1001?deleted=false' \
--header 'Authorization: YOUR_API_TOKEN'
const response = await fetch('https://api.selsup.ru/api/manufacturer/1001?deleted=false', {
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 result = await response.json();
const response: Response = await fetch('https://api.selsup.ru/api/manufacturer/1001?deleted=false', {
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');
}
const result: unknown = await response.json();
import os
import requests
response = requests.delete(
'https://api.selsup.ru/api/manufacturer/1001?deleted=false',
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/manufacturer/1001?deleted=false',
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/manufacturer/1001?deleted=false", 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/manufacturer/1001?deleted=false"))
.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());
}
}
"string"应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
/api/manufacturer使用 POST /api/manufacturer.创建制造商
application/jsonManufacturer| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 否 | 制造商身份 |
title |
string | 否 | 标题 |
name |
string | 是 | 姓名. |
address |
string | 否 | 现在,我有个地址. |
organizationId |
integer · int64 | 否 | 组织身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
countryId |
integer · int32 | 否 | 国家的身份证. |
countryName |
string | 否 | 国家的名称. |
inn |
string | 否 | 酒店. |
deleted |
boolean | 否 | 删除了. |
oneCId |
string | 否 | 一个公告. |
curl --request POST 'https://api.selsup.ru/api/manufacturer' \
--header 'Authorization: YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}'
const response = await fetch('https://api.selsup.ru/api/manufacturer', {
method: 'POST',
headers: {
Authorization: process.env.SELSUP_API_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"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/manufacturer', {
method: 'POST',
headers: {
Authorization: process.env.SELSUP_API_TOKEN!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"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/manufacturer',
headers={'Authorization': os.environ['SELSUP_API_TOKEN']},
json={
'name': 'Example',
'manufacturerId': 1001,
'title': 'Example',
'address': 'string',
'organizationId': 1001,
'clientId': 1001
},
)
response.raise_for_status()
result = response.json()
<?php
$payload = <<<'JSON'
{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}
JSON;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.selsup.ru/api/manufacturer',
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/manufacturer", strings.NewReader(`{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"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/manufacturer"))
.header("Authorization", System.getenv("SELSUP_API_TOKEN"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}
"""))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
Manufacturer
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 否 | 制造商身份 |
title |
string | 否 | 标题 |
name |
string | 是 | 姓名. |
address |
string | 否 | 现在,我有个地址. |
organizationId |
integer · int64 | 否 | 组织身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
countryId |
integer · int32 | 否 | 国家的身份证. |
countryName |
string | 否 | 国家的名称. |
inn |
string | 否 | 酒店. |
deleted |
boolean | 否 | 删除了. |
oneCId |
string | 否 | 一个公告. |
{
"name": "Example",
"manufacturerId": 1001,
"title": "Example",
"address": "string",
"organizationId": 1001,
"clientId": 1001
}应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_empty_manufacturer_name应用逻辑中使用稳定的error_empty_manufacturer_name代码;localMessage包含上述翻译.
error_manufacturer_already_exist应用逻辑中使用稳定的error_manufacturer_already_exist代码;localMessage包含上述翻译.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.
error_subscription_expired应用逻辑中使用稳定的error_subscription_expired代码;localMessage包含上述翻译.
/api/manufacturer/find使用 GET 找到 /api/manufacturer/find.
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
query |
string | 否 | 问问. |
manufacturerOneCId |
string | 否 | 制造商1号信息中心 |
limit |
integer · int32 | 否 | 限制. |
page |
integer · int32 | 否 | 页面. |
count |
boolean | 否 | 伯爵. |
sortBy |
stringMANUFACTURERID, NAME | 否 | 排序了. |
ascending |
boolean | 否 | 升高. |
curl --request GET 'https://api.selsup.ru/api/manufacturer/find?limit=50&page=1' \
--header 'Authorization: YOUR_API_TOKEN'
const response = await fetch('https://api.selsup.ru/api/manufacturer/find?limit=50&page=1', {
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/manufacturer/find?limit=50&page=1', {
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/manufacturer/find?limit=50&page=1',
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/manufacturer/find?limit=50&page=1',
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/manufacturer/find?limit=50&page=1", 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/manufacturer/find?limit=50&page=1"))
.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());
}
}
FindResponseManufacturer
| 字段 | 类型 | 必填 | 描述 | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rows |
Manufacturer[] | 否 | 排列. | ||||||||||||||||||||||||||||||||||||||||||||||||
阵列项结构
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
manufacturerId |
integer · int32 | 否 | 制造商身份 |
title |
string | 否 | 标题 |
name |
string | 是 | 姓名. |
address |
string | 否 | 现在,我有个地址. |
organizationId |
integer · int64 | 否 | 组织身份证. |
clientId |
integer · int64 | 否 | 客户身份证. |
countryId |
integer · int32 | 否 | 国家的身份证. |
countryName |
string | 否 | 国家的名称. |
inn |
string | 否 | 酒店. |
deleted |
boolean | 否 | 删除了. |
oneCId |
string | 否 | 一个公告. |
{
"rows": "string"
}应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑
auth_requiredAuthorization 缺失,空,或包含无效的代币.
error_access_denied代币存在,但它的作用不能执行这个操作.
error_unknown节省请求时间和联系支持;不要盲目重新尝试突变.
error_no_client应用逻辑中使用稳定的error_no_client代码;localMessage包含上述翻译.
error_subscription_expired应用逻辑中使用稳定的error_subscription_expired代码;localMessage包含上述翻译.