蝦皮API介面根據關鍵詞取商品列表(商品詳情,庫存,排序,價格...)返回值及說明

API測試Cris發表於2023-04-15

引數說明

通用引數說明


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 寶貝圖片

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 寶貝連結

請求示例


請求示例(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": "

"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": "

"price": 38.9,

"promotion_price": 0,

"price_range": 0,

"num_iid": "277113808/4577557680",

"shop_id": "277113808",

"sales": 293,

"area": "Kelantan",

"detail_url": "

},

{

"title": "Color ",

"pic_url": "

"price": 48,

"promotion_price": 109,

"price_range": 0,

"num_iid": "54302529/6310239196",

"shop_id": "54302529",

"sales": 439,

"area": "Selangor",

"detail_url": "

},

{

"title": "COLOUR",

"pic_url": "

"price": 38.9,

"promotion_price": 0,

"price_range": 0,

"num_iid": "277113808/4577557680",

"shop_id": "277113808",

"sales": 293,

"area": "Kelantan",

"detail_url": "

},

{

"title": "COLOUR",

"pic_url": "

"price": 18.9,

"promotion_price": 50,

"price_range": 0,

"num_iid": "78566717/2019203919",

"shop_id": "78566717",

"sales": 887,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 25.26,

"promotion_price": 0,

"price_range": 0,

"num_iid": "240981936/3767955639",

"shop_id": "240981936",

"sales": 22,

"area": "Indonesia",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 18.9,

"promotion_price": 21,

"price_range": 0,

"num_iid": "390574271/8216725690",

"shop_id": "390574271",

"sales": 0,

"area": "Mainland China",

"detail_url": "

},

{

"title": "option1",

"pic_url": "

"price": 32,

"promotion_price": 53.34,

"price_range": 0,

"num_iid": "26973388/5351395820",

"shop_id": "26973388",

"sales": 1271,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color ",

"pic_url": "

"price": 48,

"promotion_price": 109,

"price_range": 0,

"num_iid": "54302529/6310239196",

"shop_id": "54302529",

"sales": 439,

"area": "Selangor",

"detail_url": "

},

{

"title": "colour",

"pic_url": "

"price": 23.9,

"promotion_price": 48,

"price_range": 0,

"num_iid": "118973108/5244061133",

"shop_id": "118973108",

"sales": 268,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 26,

"promotion_price": 42,

"price_range": 0,

"num_iid": "368772413/4773662993",

"shop_id": "368772413",

"sales": 0,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 10.24,

"promotion_price": 10.34,

"price_range": 0,

"num_iid": "273313466/4038282148",

"shop_id": "273313466",

"sales": 132,

"area": "Indonesia",

"detail_url": "

},

{

"title": "\u989c\u8272",

"pic_url": "

"price": 16,

"promotion_price": 32,

"price_range": 0,

"num_iid": "166802812/2619757261",

"shop_id": "166802812",

"sales": 38,

"area": "Mainland China",

"detail_url": "

},

{

"title": "COLOR",

"pic_url": "

"price": 24.29,

"promotion_price": 35.63,

"price_range": 0,

"num_iid": "240979832/3627357801",

"shop_id": "240979832",

"sales": 6,

"area": "Indonesia",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"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": "

"price": 16.75,

"promotion_price": 22.4,

"price_range": 0,

"num_iid": "240873459/6332529823",

"shop_id": "240873459",

"sales": 120,

"area": "Indonesia",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 29.8,

"promotion_price": 54.29,

"price_range": 0,

"num_iid": "116989194/7643529171",

"shop_id": "116989194",

"sales": 1,

"area": "Mainland China",

"detail_url": "

},

{

"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": "

"price": 16.9,

"promotion_price": 27.8,

"price_range": 0,

"num_iid": "272814704/3152795864",

"shop_id": "272814704",

"sales": 257,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 15,

"promotion_price": 28.75,

"price_range": 0,

"num_iid": "294988554/3548057895",

"shop_id": "294988554",

"sales": 176,

"area": "Mainland China",

"detail_url": "

},

{

"title": "colour",

"pic_url": "

"price": 59.8,

"promotion_price": 92.86,

"price_range": 0,

"num_iid": "311778196/7857696922",

"shop_id": "311778196",

"sales": 1,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 35.9,

"promotion_price": 359,

"price_range": 0,

"num_iid": "26973388/3159579136",

"shop_id": "26973388",

"sales": 161,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 80,

"promotion_price": 0,

"price_range": 0,

"num_iid": "12320460/7013179933",

"shop_id": "12320460",

"sales": 0,

"area": "Johor",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 16.39,

"promotion_price": 0,

"price_range": 0,

"num_iid": "273313598/7238332374",

"shop_id": "273313598",

"sales": 65,

"area": "Indonesia",

"detail_url": "

},

{

"title": "Size",

"pic_url": "

"price": 23.4,

"promotion_price": 39,

"price_range": 0,

"num_iid": "68712033/2255244034",

"shop_id": "68712033",

"sales": 64,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Moscrepe Aluna",

"pic_url": "

"price": 30.25,

"promotion_price": 40.1,

"price_range": 0,

"num_iid": "240979181/3825017904",

"shop_id": "240979181",

"sales": 26,

"area": "Indonesia",

"detail_url": "

},

{

"title": "\u989c\u8272",

"pic_url": "

"price": 16.5,

"promotion_price": 55,

"price_range": 0,

"num_iid": "364991146/5578503551",

"shop_id": "364991146",

"sales": 0,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 37.9,

"promotion_price": 0,

"price_range": 0,

"num_iid": "80042016/7278146503",

"shop_id": "80042016",

"sales": 130,

"area": "Kelantan",

"detail_url": "

},

{

"title": "colour",

"pic_url": "

"price": 29.9,

"promotion_price": 65,

"price_range": 0,

"num_iid": "85110711/3547753198",

"shop_id": "85110711",

"sales": 204,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 17.8,

"promotion_price": 26.65,

"price_range": 0,

"num_iid": "50941176/5757678929",

"shop_id": "50941176",

"sales": 279,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 26,

"promotion_price": 54,

"price_range": 0,

"num_iid": "153111370/7577984519",

"shop_id": "153111370",

"sales": 9,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 12.19,

"promotion_price": 21.14,

"price_range": 0,

"num_iid": "240873459/5232553407",

"shop_id": "240873459",

"sales": 41,

"area": "Indonesia",

"detail_url": "

},

{

"title": "option1",

"pic_url": "

"price": 33,

"promotion_price": 0,

"price_range": 0,

"num_iid": "26973388/3625841277",

"shop_id": "26973388",

"sales": 31,

"area": "Mainland China",

"detail_url": "

},

{

"title": "color",

"pic_url": "

"price": 28.7,

"promotion_price": 41,

"price_range": 0,

"num_iid": "269975455/7360159652",

"shop_id": "269975455",

"sales": 4,

"area": "Selangor",

"detail_url": "

},

{

"title": "colour",

"pic_url": "

"price": 28.17,

"promotion_price": 281.7,

"price_range": 0,

"num_iid": "296705887/6053171855",

"shop_id": "296705887",

"sales": 0,

"area": "Mainland China",

"detail_url": "

},

{

"title": "colour",

"pic_url": "

"price": 18.8,

"promotion_price": 50,

"price_range": 0,

"num_iid": "85110711/2263563999",

"shop_id": "85110711",

"sales": 423,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Warna",

"pic_url": "

"price": 35.9,

"promotion_price": 0,

"price_range": 0,

"num_iid": "76724328/4548751809",

"shop_id": "76724328",

"sales": 410,

"area": "Kelantan",

"detail_url": "

},

{

"title": "colour",

"pic_url": "

"price": 29.9,

"promotion_price": 69,

"price_range": 0,

"num_iid": "78566717/5745307039",

"shop_id": "78566717",

"sales": 273,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 29.92,

"promotion_price": 34,

"price_range": 0,

"num_iid": "392471109/8222833825",

"shop_id": "392471109",

"sales": 0,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 47.99,

"promotion_price": 0,

"price_range": 0,

"num_iid": "241096510/6224823482",

"shop_id": "241096510",

"sales": 2,

"area": "Indonesia",

"detail_url": "

},

{

"title": "option1",

"pic_url": "

"price": 38.5,

"promotion_price": 96.25,

"price_range": 0,

"num_iid": "26973388/7254299229",

"shop_id": "26973388",

"sales": 162,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 10.99,

"promotion_price": 29.6,

"price_range": 0,

"num_iid": "190633906/4957517903",

"shop_id": "190633906",

"sales": 164,

"area": "Penang",

"detail_url": "

},

{

"title": "colour",

"pic_url": "

"price": 12.99,

"promotion_price": 0,

"price_range": 0,

"num_iid": "315952398/4775083030",

"shop_id": "315952398",

"sales": 5,

"area": "Selangor",

"detail_url": "

},

{

"title": "\u5c3a\u7801",

"pic_url": "

"price": 41.9,

"promotion_price": 69.82,

"price_range": 0,

"num_iid": "91416052/2128812451",

"shop_id": "91416052",

"sales": 5,

"area": "Mainland China",

"detail_url": "

},

{

"title": "COLOR",

"pic_url": "

"price": 36.99,

"promotion_price": 70,

"price_range": 0,

"num_iid": "190633906/4065896254",

"shop_id": "190633906",

"sales": 6,

"area": "Penang",

"detail_url": "

},

{

"title": "size",

"pic_url": "

"price": 23.9,

"promotion_price": 43.5,

"price_range": 0,

"num_iid": "31201638/2911032143",

"shop_id": "31201638",

"sales": 116,

"area": "Mainland China",

"detail_url": "

},

{

"title": "\u989c\u8272\u5206\u7c7b",

"pic_url": "

"price": 48.3,

"promotion_price": 69,

"price_range": 0,

"num_iid": "378874096/6679043850",

"shop_id": "378874096",

"sales": 0,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 16.99,

"promotion_price": 42,

"price_range": 0,

"num_iid": "274849642/6957372204",

"shop_id": "274849642",

"sales": 262,

"area": "Penang",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 17.99,

"promotion_price": 28.47,

"price_range": 0,

"num_iid": "25923976/4138240940",

"shop_id": "25923976",

"sales": 9,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 19.6,

"promotion_price": 28,

"price_range": 0,

"num_iid": "279153738/5849377285",

"shop_id": "279153738",

"sales": 32,

"area": "Mainland China",

"detail_url": "

},

{

"title": "Color",

"pic_url": "

"price": 24.88,

"promotion_price": 47,

"price_range": 0,

"num_iid": "131857747/3561843082",

"shop_id": "131857747",

"sales": 76,

"area": "Mainland China",

"detail_url": "

}

]

},

"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"

}

文章內容有限,歡迎私信溝通交流。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70028219/viewspace-2946005/,如需轉載,請註明出處,否則將追究法律責任。

相關文章