请求地址: https://api-gw.onebound.cn/china/item_get
请求参数:num_iid=4251932346
参数说明:num_iid:china商品ID
Version: Date:
-- 请求示例 url 默认请求参数已经URL编码处理 curl -i "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"
<?php // 请求示例 url 默认请求参数已经URL编码处理 // 本示例代码未加密secret参数明文传输,若要加密请参考:https://open.onebound.cn/help/demo/sdk/demo-sign.php $method = "GET"; $url = "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"; $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)); ?>
<?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服务器 $obapi->api_urls_on = true;//当网络错误时,是否启用备用API服务器 $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" =>"china", "api_name" =>"item_get", "api_params"=>array ( 'num_iid' => '4251932346', ) ) ); var_dump($api_data); ?>
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 默认请求参数已经URL编码处理 String url = "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"; JSONObject json = getRequestFromUrl(url); System.out.println(json.toString()); } }
//using System.Net.Security; //using System.Security.Cryptography.X509Certificates; private const String method = "GET"; static void Main(string[] args) { String bodys = ""; // 请求示例 url 默认请求参数已经做URL编码 String url = "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"; HttpWebRequest httpRequest = null; HttpWebResponse httpResponse = null; if (url.Contains("https://")) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url)); } else { httpRequest = (HttpWebRequest)WebRequest.Create(url); } httpRequest.Method = method; if (0 < bodys.Length) { byte[] data = Encoding.UTF8.GetBytes(bodys); using (Stream stream = httpRequest.GetRequestStream()) { stream.Write(data, 0, data.Length); } } try { httpResponse = (HttpWebResponse)httpRequest.GetResponse(); } catch (WebException ex) { httpResponse = (HttpWebResponse)ex.Response; } Console.WriteLine(httpResponse.StatusCode); Console.WriteLine(httpResponse.Method); Console.WriteLine(httpResponse.Headers); Stream st = httpResponse.GetResponseStream(); StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8")); Console.WriteLine(reader.ReadToEnd()); Console.WriteLine("\n"); } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ from __future__ import print_function import requests # 请求示例 url 默认请求参数已经做URL编码 url = "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346" headers = { "Accept-Encoding": "gzip", "Connection": "close" } if __name__ == "__main__": r = requests.get(url, headers=headers) json_obj = r.json() print(json_obj)
url := fmt.Sprintf("https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346", params) req, err := http.NewRequest("GET", url, nil) if err != nil { panic(err) } req.Header.Set("Authorization", apiKey) client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(string(body))
fetch('https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({"num_iid":"4251932346"})// request parameters here }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error(error));
<script src="js/obapi.js"></script> <script type="text/javascript"> obAPI.config({ debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 api_url: "https://api-gw.onebound.cn", // api_key: "<您自己的apiKey>", // 必填, api_secret: "<您自己的apiSecret>", // lang: "cn", // timestamp: "", // 必填,生成签名的时间戳 nonceStr: "", // 必填,生成签名的随机串 signature: "",// 必填,签名 jsApiList: [] // 必填,需要使用的JS接口列表 }); </script> <div id="api_data_box"></div> <script type="text/javascript"> obAPI.exec( { "api_type":"china", "api_name" : "item_get", "api_params": {"num_iid":"4251932346"}//num_iid=4251932346,#具体参数请参考文档说明 }, function(e){ document.querySelector("#api_data_box").innerHTML=JSON.stringify(e) } ); </script>
require "net/http" require "uri" url = URI("https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body
import Foundation let url = URL(string: "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346")! let task = URLSession.shared.dataTask(with: url) { data, response, error in guard let data = data else { print("Error: No data was returned") return } if let data = String(data: data, encoding: .utf8) { print(data) } } task.resume()
NSURL *myUrl = [NSURL URLWithString:@"https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"]; NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:myUrl cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0]; [request setHTTPMethod:@"GET"]; NSError *error; NSURLResponse *response; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@",result);
#include<stdio.h> #include <stdlib.h> #include<string.h> #include<curl/curl.h> int main(){ CURL *curl; CURLcode res; struct curl_slist *headers=NULL; char url[] = "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"; curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL,url); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); res = curl_easy_perform(curl); if(res != CURLE_OK){ printf("curl_easy_perform(): %s\n",curl_easy_strerror(res)); } curl_easy_cleanup(curl); } curl_global_cleanup(); return 0; }
#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, "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"); 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; }
const https = require("https"); https.get("https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346", (resp) => { let data = ""; resp.on("data", (chunk) => { data += chunk; }); resp.on("end", () => { console.log(data); }); }).on("error", (err) => { console.log("Error: " + err.message); });
import java.net.HttpURLConnection import java.net.URL fun main() { val url = URL("https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346") val con = url.openConnection() as HttpURLConnection con.requestMethod = "GET" val responseCode = con.responseCode if (responseCode == HttpURLConnection.HTTP_OK) { // success val inputLine = con.inputStream.bufferedReader().use { it.readText() } println(inputLine) } else { println("GET request failed") } }
use std::io::{self, Read}; use reqwest; fn main() -> io::Result<()> { let mut resp = reqwest::get("https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346")?; let mut content = String::new(); resp.read_to_string(&mut content)?; println!("{}", content); Ok(()) }
library(httr) r <- GET("https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346") content(r)
url = "https://api-gw.onebound.cn/china/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=4251932346"; response = webread(url); disp(response);
{ "item": { "num_iid": "4251932346", "title": "雪地靴女2018秋冬新款保暖加厚女靴棉鞋防滑中筒女式皮靴子", "desc_short": "靴筒内里材质:人造长毛绒靴上市年份季节:2018年秋季帮面材质:PU鞋面内里材质:人造长毛绒靴款品名:雪地靴筒高:短筒鞋头款式:圆头后跟高:中跟", "price": "49.90", "total_price": 0, "suggestive_price": 0, "orginal_price": "", "nick": "欧阳先生", "num": "2000", "unit": "双", "min_num": "3", "detail_url": "http://www.china.cn/pixue/4251932346.html", "pic_url": "https://img2.fr-trading.com/2/5_1005_1216165_800_800.jpg.webp", "brand": null, "brandId": "", "rootCatId": "", "cid": "", "favcount": "", "fanscount": "", "crumbs": [], "created_time": "", "modified_time": "", "delist_time": "", "desc": "<h2>靴筒内里材质:人造长毛绒靴上市年份季节:2018年秋季帮面材质:PU鞋面内里材质:人造长毛绒靴款品名:雪地靴筒高:短筒鞋头款式:圆头后跟高:中跟</h2><div class=\"intro fl-clr\"><p><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_754_1194903_750_574.jpg.webp\"><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_285_1196783_732_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_915_1215981_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_945_1196787_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_792_1194687_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_126_1194371_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_1005_1216165_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_1010_1215735_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_147_1195611_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_334_1196587_800_800.jpg.webp\"><br/><img class=\"lazy-load-other\" src=\"https://himg.china.cn/img/mobile/common/loading/circle-loading.svg\" data-original=\"https://img2.fr-trading.com/0/5_42_1196891_728_800.jpg.webp\"><br/></p></div>", "desc_img": [ "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg", "https://himg.china.cn/img/mobile/common/loading/circle-loading.svg" ], "item_imgs": [ { "url": " https://img2.fr-trading.com/2/5_1005_1216165_800_800.jpg.webp" }, { "url": " https://img2.fr-trading.com/2/5_792_1194687_800_800.jpg.webp" }, { "url": " https://img2.fr-trading.com/2/5_126_1194371_800_800.jpg.webp" } ], "item_weight": "", "item_size": "", "location": "浙江 温岭市", "post_fee": "", "express_fee": "", "ems_fee": "", "shipping_to": "", "has_discount": "", "video": [], "is_virtual": "", "sample_id": "", "is_promotion": "false", "props_name": "", "prop_imgs": { "prop_img": [] }, "property_alias": "", "props": [ { "name": "适用年龄段", "value": "成年" }, { "name": "产品类别", "value": "时装靴" }, { "name": "货源类别", "value": "现货" }, { "name": "是否库存", "value": "是" }, { "name": "鞋面材质", "value": "人造PU" }, { "name": "适用性别", "value": "女" }, { "name": "风格", "value": "淑女" }, { "name": "流行靴款", "value": "雪地靴" }, { "name": "流行元素", "value": "金属" }, { "name": "筒高", "value": "中筒" }, { "name": "最快出货时间", "value": "2天" }, { "name": "颜色", "value": "黑色" }, { "name": "尺码", "value": "35、36、37、38、39" }, { "name": "货号", "value": "789" }, { "name": "鞋底材质", "value": "橡胶" }, { "name": "鞋头形状", "value": "圆头" }, { "name": "鞋跟形状", "value": "粗跟" }, { "name": "鞋跟高度", "value": "平跟" }, { "name": "功能", "value": "保暖、防滑、防水" }, { "name": "厚薄", "value": "加厚" }, { "name": "穿着方式", "value": "侧拉链" }, { "name": "适合季节", "value": "秋季、冬季" }, { "name": "是否外贸", "value": "是" }, { "name": "外贸类型", "value": "出口" }, { "name": "鞋垫材质", "value": "人造毛" }, { "name": "质检报告", "value": "否" }, { "name": "质检单位", "value": "sgs" }, { "name": "内里材质", "value": "棉质" }, { "name": "靴筒内里材质", "value": "PU" }, { "name": "靴筒材质", "value": "PU" }, { "name": "上市年份季节(上市时间)", "value": "2018年秋季" }, { "name": "最晚发货时间", "value": "3天" }, { "name": "是否跨境货源", "value": "是" }, { "name": "主要销售地区", "value": "中东" }, { "name": "有可授权的自有品牌", "value": "是" }, { "name": "", "value": "" } ], "total_sold": "0", "skus": { "sku": [] }, "seller_id": "", "sales": 1, "shop_id": "", "props_list": [], "seller_info": { "title": "台州聚格商贸有限公司", "shop_name": "台州聚格商贸有限公司", "sid": "", "zhuy": "https://chuchujie.cn.china.cn", "level": "", "shop_type": "", "user_num_id": "", "nick": "台州聚格商贸有限公司", "cid": null, "delivery_score": "", "item_score": "", "score_p": "" }, "tmall": "false", "error": "", "warning": "", "url_log": [], "stuff_status": "", "data_from": "", "method": "", "promo_type": null, "props_img": [], "rate_grade": "", "priceRange": [ [ "3", "49.90" ], [ "10", "48.00" ], [ "30", "46.00" ] ], "shop_item": [], "relate_items": [] }, "secache": "e37c427ca17e47d7389fd1001f11328b", "secache_time": 1607503169, "secache_date": "2020-12-09 16:39:29", "translate_status": "", "translate_time": 0, "language": { "default_lang": "cn", "current_lang": "cn" }, "error": "", "reason": "", "error_code": "0000", "cache": 0, "api_info": "today:4 max:20000", "execution_time": 0.623, "server_time": "Beijing/2020-12-09 16:39:29", "client_ip": "182.103.240.215", "call_args": { "num_iid": "4251932346" }, "api_type": "china", "translate_language": "zh-CN", "translate_engine": "google_cn", "server_memory": "2.9MB", "request_id": "4.5fd08d415d7bf" }
{ "error": "item-not-found", "reason": "商品没找到", "error_code": "2000", "success": 0, "cache": 0, "api_info": "today:0 max:10000", "execution_time": 0.081, "server_time": "Beijing/2020-06-10 23:44:00", "call_args": [], "api_type": "1688", "request_id": "15ee0ffc041242" }