虾皮API接口根据关键词取商品列表(商品详情,库存,排序,价格...)返回值及说明

发布时间 2023-04-15 14:43:05作者: API测试开发Cris

参数说明
通用参数说明

version:API版本

key:调用key,测试key:test_api_key

api_name:API类型[item_search,item_get]

cache:[yes,no]默认yes,将调用缓存的数据,速度比较快

result_type:[json,xml,serialize,var_export]返回数据格式,默认为json

lang:[cn,en,ru] 翻译语言,默认cn简体中文

API:item_search 参数说明: q:搜索关键词 cat:分类ID start_price:开始价格 end_price:结束

价格 sort:排序 page:

API:item_get 参数说明: num_iid:商品id【num_iid=1520294】

shopee.item_search

公共参数

名称 类型 必须 描述
key String 是 调用key(必须以GET方式拼接在URL中)
secret String 是 调用密钥(接口v,18870288846;)
api_name String 是 API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
cache String 否 [yes,no]默认yes,将调用缓存的数据,速度比较快
result_type String 否 [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
lang String 否 [cn,en,ru]翻译语言,默认cn简体中文
version String 否 API版本

请求参数测试

请求参数:q=dress&page=1&sort=&country=.com.my

参数说明:q:搜索关键词-country:网站后缀(.com.my;.vn;.ph),
sort:排序[bid,_bid,_sale,new]
(bid:总价,sale:销量,new:新品,加_前缀为从大到小排序)
page:页数

响应参数

Version: Date:

名称 类型 必须 示例值 描述
items

item[] 0 根据关键词取商品列表
title

String 0 Real Shot Long Dress Female Summer New Womens Waist Slimming Dress Summer Temperament Dress Popular Fake Two-Piece Dres 商品标题
pic_url

String 0 https://cf.shopee.com.my/file/902d7fd4f24d056d89163e4f32fcc8c2 宝贝图片
promotion_price

Float 0 82.00 优惠价
price_range

Float 0 0 折扣价
price

Float 0 82.00 价格
sales

Int 0 0 销量
num_iid

Bigint 0 334425154/8200081234 宝贝ID
shop_id

Bigint 0 334425154 店铺ID
area

String 0 Kuala Lumpur 店铺所在地
detail_url

String 0 https://shopee.com.my/product/334425154/8200081234 宝贝链接
请求示例

请求示例(Curl、PHP、PHPsdk、JAVA、C#、Python...)

#include<iostream>
#include<string>
#include<curl/curl.h>

using namespace std;

static size_t Data(void *ptr, size_t size, size_t nmemb, string *stream)
{
std::size_t realSize = size *nmemb;
auto *realPtr = reinterpret_cast<char *>(ptr);

for (std::size_t i=0;i<realSize;++i) {
*(stream) += *(realPtr + i);
}

return realSize;
}

int main(){

CURL *curl;
CURLcode result;
string readBuffer;
curl = curl_easy_init();

if(curl) {

curl_easy_setopt(curl, CURLOPT_URL, "v,x;18870288846/key=<您自己的apiKey>&secret=<您自己的apiSecret>&q=dress&page=1&sort=&country=.com.my");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);

result = curl_easy_perform(curl);

if(result == CURLE_OK) {
cout<<readBuffer<<endl;
}else{
cerr<<"curl_easy error:"<<curl_easy_strerror(result)<<endl;
}

curl_easy_cleanup(curl);
}
return 0;
}

响应示例

{
"items": {
"url": "https://shopee.com.my/search?keyword=dress",
"keyword": "dress",
"list_page": "1",
"real_total_results": "4269453",
"total_results": 5000,
"pagecount": 100,
"current_lang": "en",
"currency_code": "MYR",
"item": [
{
"title": "COLOUR",
"pic_url": "https://cf.shopee.com.my/file/79ec29aaa306ec1defd6bd555967702d",
"price": 38.9,
"promotion_price": 0,
"price_range": 0,
"num_iid": "277113808/4577557680",
"shop_id": "277113808",
"sales": 293,
"area": "Kelantan",
"detail_url": "https://shopee.com.my/product/277113808/4577557680"
},
{
"title": "Color ",
"pic_url": "https://cf.shopee.com.my/file/bcad44beb00c73a6e4521d6a9d9f5c27",
"price": 48,
"promotion_price": 109,
"price_range": 0,
"num_iid": "54302529/6310239196",
"shop_id": "54302529",
"sales": 439,
"area": "Selangor",
"detail_url": "https://shopee.com.my/product/54302529/6310239196"
},
{
"title": "COLOUR",
"pic_url": "https://cf.shopee.com.my/file/79ec29aaa306ec1defd6bd555967702d",
"price": 38.9,
"promotion_price": 0,
"price_range": 0,
"num_iid": "277113808/4577557680",
"shop_id": "277113808",
"sales": 293,
"area": "Kelantan",
"detail_url": "https://shopee.com.my/product/277113808/4577557680"
},
{
"title": "COLOUR",
"pic_url": "https://cf.shopee.com.my/file/f22290486f37305dbee21e25824894dc",
"price": 18.9,
"promotion_price": 50,
"price_range": 0,
"num_iid": "78566717/2019203919",
"shop_id": "78566717",
"sales": 887,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/78566717/2019203919"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/69ddc45fbedfb8eb054c915199cfda99",
"price": 25.26,
"promotion_price": 0,
"price_range": 0,
"num_iid": "240981936/3767955639",
"shop_id": "240981936",
"sales": 22,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/240981936/3767955639"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/531b217d8c9c23844a27c43e8dd4f7c0",
"price": 18.9,
"promotion_price": 21,
"price_range": 0,
"num_iid": "390574271/8216725690",
"shop_id": "390574271",
"sales": 0,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/390574271/8216725690"
},
{
"title": "option1",
"pic_url": "https://cf.shopee.com.my/file/c7aa7707e693d01279879e2e2f042009",
"price": 32,
"promotion_price": 53.34,
"price_range": 0,
"num_iid": "26973388/5351395820",
"shop_id": "26973388",
"sales": 1271,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/26973388/5351395820"
},
{
"title": "Color ",
"pic_url": "https://cf.shopee.com.my/file/bcad44beb00c73a6e4521d6a9d9f5c27",
"price": 48,
"promotion_price": 109,
"price_range": 0,
"num_iid": "54302529/6310239196",
"shop_id": "54302529",
"sales": 439,
"area": "Selangor",
"detail_url": "https://shopee.com.my/product/54302529/6310239196"
},
{
"title": "colour",
"pic_url": "https://cf.shopee.com.my/file/e5bc52ad097fbdfbaaaf2eae3da39880",
"price": 23.9,
"promotion_price": 48,
"price_range": 0,
"num_iid": "118973108/5244061133",
"shop_id": "118973108",
"sales": 268,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/118973108/5244061133"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/c48b6ca6496ed80ba47c0a21a8b243ce",
"price": 26,
"promotion_price": 42,
"price_range": 0,
"num_iid": "368772413/4773662993",
"shop_id": "368772413",
"sales": 0,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/368772413/4773662993"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/16a71110a030cfe43bfb617b6bc32abb",
"price": 10.24,
"promotion_price": 10.34,
"price_range": 0,
"num_iid": "273313466/4038282148",
"shop_id": "273313466",
"sales": 132,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/273313466/4038282148"
},
{
"title": "\u989c\u8272",
"pic_url": "https://cf.shopee.com.my/file/1a8c372af4c52b11717ab4f0ffb9c00b",
"price": 16,
"promotion_price": 32,
"price_range": 0,
"num_iid": "166802812/2619757261",
"shop_id": "166802812",
"sales": 38,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/166802812/2619757261"
},
{
"title": "COLOR",
"pic_url": "https://cf.shopee.com.my/file/3eca8b3323a29f999504b394f6b30c56",
"price": 24.29,
"promotion_price": 35.63,
"price_range": 0,
"num_iid": "240979832/3627357801",
"shop_id": "240979832",
"sales": 6,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/240979832/3627357801"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/27cda947ff9286b7d5a4e7923b06ccdd",
"price": 18,
"promotion_price": 20,
"price_range": 0,
"num_iid": "390574271/8316886597",
"shop_id": "390574271",
"sales": 2,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/390574271/8316886597"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/4ce9ba7aec97238b6552a9f0d124d0d6",
"price": 16.75,
"promotion_price": 22.4,
"price_range": 0,
"num_iid": "240873459/6332529823",
"shop_id": "240873459",
"sales": 120,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/240873459/6332529823"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/610dfbe249afa5afaa2947338f57b849",
"price": 29.8,
"promotion_price": 54.29,
"price_range": 0,
"num_iid": "116989194/7643529171",
"shop_id": "116989194",
"sales": 1,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/116989194/7643529171"
},
{
"title": "Variasi",
"pic_url": "https://cf.shopee.com.my/file/78dd16816995d5094e6ccce39fe2ab52",
"price": 34,
"promotion_price": 0,
"price_range": 0,
"num_iid": "30168757/2120468722",
"shop_id": "30168757",
"sales": 94,
"area": "Kelantan",
"detail_url": "https://shopee.com.my/product/30168757/2120468722"
},
{
"title": "Colour",
"pic_url": "https://cf.shopee.com.my/file/e01a4687db19ab188aacb930a41771a7",
"price": 16.9,
"promotion_price": 27.8,
"price_range": 0,
"num_iid": "272814704/3152795864",
"shop_id": "272814704",
"sales": 257,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/272814704/3152795864"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/12ecc59c016ce51740b45e5455af1bfc",
"price": 15,
"promotion_price": 28.75,
"price_range": 0,
"num_iid": "294988554/3548057895",
"shop_id": "294988554",
"sales": 176,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/294988554/3548057895"
},
{
"title": "colour",
"pic_url": "https://cf.shopee.com.my/file/505f3e0cf78e9c94fe473e0cc1016946",
"price": 59.8,
"promotion_price": 92.86,
"price_range": 0,
"num_iid": "311778196/7857696922",
"shop_id": "311778196",
"sales": 1,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/311778196/7857696922"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/fa8cb30e3150087d07f7a5e967a861e9",
"price": 35.9,
"promotion_price": 359,
"price_range": 0,
"num_iid": "26973388/3159579136",
"shop_id": "26973388",
"sales": 161,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/26973388/3159579136"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/f35b103b9b494eb9619a4057742efc0a",
"price": 80,
"promotion_price": 0,
"price_range": 0,
"num_iid": "12320460/7013179933",
"shop_id": "12320460",
"sales": 0,
"area": "Johor",
"detail_url": "https://shopee.com.my/product/12320460/7013179933"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/6bf33fda1f38bae6378d861886ae2e8f",
"price": 16.39,
"promotion_price": 0,
"price_range": 0,
"num_iid": "273313598/7238332374",
"shop_id": "273313598",
"sales": 65,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/273313598/7238332374"
},
{
"title": "Size",
"pic_url": "https://cf.shopee.com.my/file/23fc72ee140222c60c2a01765ffa05f7",
"price": 23.4,
"promotion_price": 39,
"price_range": 0,
"num_iid": "68712033/2255244034",
"shop_id": "68712033",
"sales": 64,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/68712033/2255244034"
},
{
"title": "Moscrepe Aluna",
"pic_url": "https://cf.shopee.com.my/file/4c912ac2ad3cda4529ceba861f31ff28",
"price": 30.25,
"promotion_price": 40.1,
"price_range": 0,
"num_iid": "240979181/3825017904",
"shop_id": "240979181",
"sales": 26,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/240979181/3825017904"
},
{
"title": "\u989c\u8272",
"pic_url": "https://cf.shopee.com.my/file/14de9cc56c7a6a0fbae96d761f41e4d0",
"price": 16.5,
"promotion_price": 55,
"price_range": 0,
"num_iid": "364991146/5578503551",
"shop_id": "364991146",
"sales": 0,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/364991146/5578503551"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/51e95bf0b8422f67ed2e4e47151e2d9d",
"price": 37.9,
"promotion_price": 0,
"price_range": 0,
"num_iid": "80042016/7278146503",
"shop_id": "80042016",
"sales": 130,
"area": "Kelantan",
"detail_url": "https://shopee.com.my/product/80042016/7278146503"
},
{
"title": "colour",
"pic_url": "https://cf.shopee.com.my/file/a5982e8e7b00385880b70460e66cf979",
"price": 29.9,
"promotion_price": 65,
"price_range": 0,
"num_iid": "85110711/3547753198",
"shop_id": "85110711",
"sales": 204,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/85110711/3547753198"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/cb80c011268dc3b328e721eaa319828e",
"price": 17.8,
"promotion_price": 26.65,
"price_range": 0,
"num_iid": "50941176/5757678929",
"shop_id": "50941176",
"sales": 279,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/50941176/5757678929"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/f4f66325663acd2a7621dfcacf5b9048",
"price": 26,
"promotion_price": 54,
"price_range": 0,
"num_iid": "153111370/7577984519",
"shop_id": "153111370",
"sales": 9,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/153111370/7577984519"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/f995bc98ccfc9bafc7d019574439bb69",
"price": 12.19,
"promotion_price": 21.14,
"price_range": 0,
"num_iid": "240873459/5232553407",
"shop_id": "240873459",
"sales": 41,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/240873459/5232553407"
},
{
"title": "option1",
"pic_url": "https://cf.shopee.com.my/file/fad83fed4fab8d040ffc4450aef600ef",
"price": 33,
"promotion_price": 0,
"price_range": 0,
"num_iid": "26973388/3625841277",
"shop_id": "26973388",
"sales": 31,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/26973388/3625841277"
},
{
"title": "color",
"pic_url": "https://cf.shopee.com.my/file/5c566443083012c92cfdd255bb116e36",
"price": 28.7,
"promotion_price": 41,
"price_range": 0,
"num_iid": "269975455/7360159652",
"shop_id": "269975455",
"sales": 4,
"area": "Selangor",
"detail_url": "https://shopee.com.my/product/269975455/7360159652"
},
{
"title": "colour",
"pic_url": "https://cf.shopee.com.my/file/2c27504fb4455666c3f451538d0dc16d",
"price": 28.17,
"promotion_price": 281.7,
"price_range": 0,
"num_iid": "296705887/6053171855",
"shop_id": "296705887",
"sales": 0,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/296705887/6053171855"
},
{
"title": "colour",
"pic_url": "https://cf.shopee.com.my/file/27b4c073e90d04b7f57f0b62a46e9a4e",
"price": 18.8,
"promotion_price": 50,
"price_range": 0,
"num_iid": "85110711/2263563999",
"shop_id": "85110711",
"sales": 423,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/85110711/2263563999"
},
{
"title": "Warna",
"pic_url": "https://cf.shopee.com.my/file/c9d7f3f8c8ca8de0c3556a1a9cbeded5",
"price": 35.9,
"promotion_price": 0,
"price_range": 0,
"num_iid": "76724328/4548751809",
"shop_id": "76724328",
"sales": 410,
"area": "Kelantan",
"detail_url": "https://shopee.com.my/product/76724328/4548751809"
},
{
"title": "colour",
"pic_url": "https://cf.shopee.com.my/file/1f85b2cf192acd20a26142dd4ab9fbee",
"price": 29.9,
"promotion_price": 69,
"price_range": 0,
"num_iid": "78566717/5745307039",
"shop_id": "78566717",
"sales": 273,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/78566717/5745307039"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/30723f5141f74cced951319a2924c235",
"price": 29.92,
"promotion_price": 34,
"price_range": 0,
"num_iid": "392471109/8222833825",
"shop_id": "392471109",
"sales": 0,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/392471109/8222833825"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/2130c2b2b37eed64f3c064bd166f62f3",
"price": 47.99,
"promotion_price": 0,
"price_range": 0,
"num_iid": "241096510/6224823482",
"shop_id": "241096510",
"sales": 2,
"area": "Indonesia",
"detail_url": "https://shopee.com.my/product/241096510/6224823482"
},
{
"title": "option1",
"pic_url": "https://cf.shopee.com.my/file/f1648e0a9f0132489995670aafff02d1",
"price": 38.5,
"promotion_price": 96.25,
"price_range": 0,
"num_iid": "26973388/7254299229",
"shop_id": "26973388",
"sales": 162,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/26973388/7254299229"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/5293afb8d03bfe7e58fe77ab638fd28d",
"price": 10.99,
"promotion_price": 29.6,
"price_range": 0,
"num_iid": "190633906/4957517903",
"shop_id": "190633906",
"sales": 164,
"area": "Penang",
"detail_url": "https://shopee.com.my/product/190633906/4957517903"
},
{
"title": "colour",
"pic_url": "https://cf.shopee.com.my/file/556318a4800946f504aeadd08343c002",
"price": 12.99,
"promotion_price": 0,
"price_range": 0,
"num_iid": "315952398/4775083030",
"shop_id": "315952398",
"sales": 5,
"area": "Selangor",
"detail_url": "https://shopee.com.my/product/315952398/4775083030"
},
{
"title": "\u5c3a\u7801",
"pic_url": "https://cf.shopee.com.my/file/81aabf540b0657fa45266cf222b8d214",
"price": 41.9,
"promotion_price": 69.82,
"price_range": 0,
"num_iid": "91416052/2128812451",
"shop_id": "91416052",
"sales": 5,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/91416052/2128812451"
},
{
"title": "COLOR",
"pic_url": "https://cf.shopee.com.my/file/9b33c95178bd0ccaf23e5c784f29d1a1",
"price": 36.99,
"promotion_price": 70,
"price_range": 0,
"num_iid": "190633906/4065896254",
"shop_id": "190633906",
"sales": 6,
"area": "Penang",
"detail_url": "https://shopee.com.my/product/190633906/4065896254"
},
{
"title": "size",
"pic_url": "https://cf.shopee.com.my/file/dcd31f57e2e3984536c773d161a8bed1",
"price": 23.9,
"promotion_price": 43.5,
"price_range": 0,
"num_iid": "31201638/2911032143",
"shop_id": "31201638",
"sales": 116,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/31201638/2911032143"
},
{
"title": "\u989c\u8272\u5206\u7c7b",
"pic_url": "https://cf.shopee.com.my/file/a9023f8d8be2fbcc1a938bcfc7b27512",
"price": 48.3,
"promotion_price": 69,
"price_range": 0,
"num_iid": "378874096/6679043850",
"shop_id": "378874096",
"sales": 0,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/378874096/6679043850"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/848c826842b59b27c1b31dabd653efa9",
"price": 16.99,
"promotion_price": 42,
"price_range": 0,
"num_iid": "274849642/6957372204",
"shop_id": "274849642",
"sales": 262,
"area": "Penang",
"detail_url": "https://shopee.com.my/product/274849642/6957372204"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/8f9a01874b165a4e00776cbf60500885",
"price": 17.99,
"promotion_price": 28.47,
"price_range": 0,
"num_iid": "25923976/4138240940",
"shop_id": "25923976",
"sales": 9,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/25923976/4138240940"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/e1bc892a6ccbde64603240fb27541359",
"price": 19.6,
"promotion_price": 28,
"price_range": 0,
"num_iid": "279153738/5849377285",
"shop_id": "279153738",
"sales": 32,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/279153738/5849377285"
},
{
"title": "Color",
"pic_url": "https://cf.shopee.com.my/file/22de9f90c55e72d3f44d918c7dd4f36a",
"price": 24.88,
"promotion_price": 47,
"price_range": 0,
"num_iid": "131857747/3561843082",
"shop_id": "131857747",
"sales": 76,
"area": "Mainland China",
"detail_url": "https://shopee.com.my/product/131857747/3561843082"
}
]
},
"error_code": "0000",
"reason": "ok",
"secache": "c223e77fc7d95dc48aa390259d5198a8",
"secache_time": 1615425217,
"secache_date": "2021-03-11 09:13:37",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"error": "",
"cache": 0,
"api_info": "today:2 max:10000",
"execution_time": 3.715,
"server_time": "Beijing/2021-03-11 09:13:37",
"client_ip": "106.6.35.144",
"call_args": {
"q": "dress",
"start_price": "1",
"page": ".com.my"
},
"api_type": "shopee",
"translate_language": "zh-CN",
"translate_engine": "baidu",
"server_memory": "3.07MB",
"request_id": "gw-1.60496ebd9ed56"
}
文章内容有限,欢迎私信沟通交流。