5 分钟内完成第一次 API 调用。
获取 API Key
请前往 出海匠开放平台 获取 API Key(以 sk_live_ 开头)。
发起第一次请求
搜索 TikTok 上与 "phone case" 相关的商品:
curl -X GET "https://openapi.gateway.chuhaijiang.com/open/v1/products/search?keyword=phone%20case&country=us&sort=gmv_7d:desc&page=1&page_size=5" \
-H "Authorization: Bearer sk_live_xxxxxxxxxxxxxxxx"
返回示例:
{
"data": {
"items": [
{
"id": "123456",
"title": "Silicone Phone Case for iPhone 15",
"price": 4.99,
"sales": 52300,
"country": "us"
}
],
"total_count": 1580
},
"request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
代码示例
Python
import requests
headers = {
"Authorization": "Bearer sk_live_xxxxxxxxxxxxxxxx"
}
resp = requests.get(
"https://openapi.gateway.chuhaijiang.com/open/v1/products/search",
headers=headers,
params={"keyword": "phone", "country": "us", "page": 1, "page_size": 20}
)
print(resp.json())
Node.js
const resp = await fetch(
"https://openapi.gateway.chuhaijiang.com/open/v1/products/search?keyword=phone&country=us&page=1&page_size=20",
{
headers: {
"Authorization": "Bearer sk_live_xxxxxxxxxxxxxxxx"
}
}
);
const data = await resp.json();
console.log(data);
认证方式
| 方式 | 示例 |
|---|
| Authorization Header | Authorization: Bearer sk_live_xxx |
| X-API-Key Header | X-API-Key: sk_live_xxx |
API Key 必须以 sk_live_ 开头,否则返回 AUTH_INVALID_KEY 错误。API Key 等同于密码,请妥善保管。
Last modified on