-
參數(shù)說明
-
通用參數(shù)說明
- version:API版本
- key:調(diào)用key,測試key:test_api_key
- api_name:API類型[item_get,item_search]
- cache:[yes,no]默認(rèn)yes,將調(diào)用緩存的數(shù)據(jù),速度比較快
- result_type:[json,xml,serialize,var_export]返回數(shù)據(jù)格式,默認(rèn)為json
- lang:[cn,en,ru] 翻譯語言,默認(rèn)cn簡體中文
-
API:item_get 參數(shù)說明: num_iid:寶貝ID
-
-
此API目前支持以下基本接口:
- item_get 獲得淘寶商品詳情
- item_search 獲得淘寶商品詳情
?其他接口請參考測試界面參數(shù)?
公共參數(shù)
名稱 | 類型 | 必須 | 描述 |
---|---|---|---|
key | String | 是 | 調(diào)用key(必須以GET方式拼接在URL中) |
secret | String | 是 | 調(diào)用密鑰 |
api_name | String | 是 | API接口名稱(包括在請求地址中)[item_search,item_get,item_search_shop等] |
cache | String | 否 | [yes,no]默認(rèn)yes,將調(diào)用緩存的數(shù)據(jù),速度比較快 |
result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回數(shù)據(jù)格式,默認(rèn)為json,jsonu輸出的內(nèi)容中文可以直接閱讀 |
lang | String | 否 | [cn,en,ru]翻譯語言,默認(rèn)cn簡體中文 |
version | String | 否 | API版本 |
請求參數(shù)
請求參數(shù):num_iid=267690734&nation=co.th
參數(shù)說明:num_iid:lazada商品ID(是對應(yīng)國家不同國家的ID不能通用)
nation:國家
國家域名后綴可選值如下:co.id、com.my、com.ph、sg、co.th、vn
響應(yīng)參數(shù)
Version: Date:
名稱 | 類型 | 必須 | 示例值 | 描述 |
---|---|---|---|---|
item |
item[] | 0 | 獲得lazada商品詳情 |
?請求示例
Curl
-- 請求示例 url 默認(rèn)請求參數(shù)已經(jīng)URL編碼處理 curl -i "https://api-gw.onebound.cn/lazada/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=267690734&nation=co.th"
PHP
<?php
// 請求示例 url 默認(rèn)請求參數(shù)已經(jīng)URL編碼處理
// 本示例代碼未加密secret參數(shù)明文傳輸,若要加密請參考:https://open.onebound.cn/help/demo/sdk/demo-sign.php
$method = "GET";
$url = "https://api-gw.onebound.cn/lazada/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=267690734&nation=co.th";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
var_dump(curl_exec($curl));
?>
PHPsdk文章來源:http://www.zghlxwxcb.cn/news/detail-416677.html
<?php
//定義緩存目錄和引入文件
define("DIR_RUNTIME","runtime/");
define("DIR_ERROR","runtime/");
define("SECACHE_SIZE","0");
//SDK下載地址 https://open.onebound.cn/help/demo/sdk/onebound-api-sdk.zip
include ("ObApiClient.php");
$obapi = new otao\ObApiClient();
$obapi->api_url = "http://api-gw.onebound.cn/";
$obapi->api_urls = array("http://api-gw.onebound.cn/","http://api-1.onebound.cn/");//備用API服務(wù)器
$obapi->api_urls_on = true;//當(dāng)網(wǎng)絡(luò)錯誤時,是否啟用備用API服務(wù)器
$obapi->api_key = "<您自己的apiKey>";
$obapi->api_secret = "<您自己的apiSecret>";
$obapi->api_version ="";
$obapi->secache_path ="runtime/";
$obapi->secache_time ="86400";
$obapi->cache = true;
$api_data = $obapi->exec(
array(
"api_type" =>"lazada",
"api_name" =>"item_get",
"api_params"=>array (
'num_iid' => '267690734',
'nation' => 'co.th',
)
)
);
var_dump($api_data);
?>
JAVA文章來源地址http://www.zghlxwxcb.cn/news/detail-416677.html
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.PrintWriter;
import java.net.URLConnection;
public class Example {
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.print(body);
out.flush();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static void main(String[] args) throws IOException, JSONException {
// 請求示例 url 默認(rèn)請求參數(shù)已經(jīng)URL編碼處理
String url = "https://api-gw.onebound.cn/lazada/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=267690734&nation=co.th";
JSONObject json = getRequestFromUrl(url);
System.out.println(json.toString());
}
}
到了這里,關(guān)于LAZADA平臺開放接口的接入和參數(shù)說明(目前支持以下基本接口:item_get 獲得淘寶商品詳情item_search 獲得淘寶商品詳情)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!