API interface is a commercial software development tool that can help developers realize business requirements. Through the API interface, developers can quickly build their own applications, realize data collection, analysis and processing, and also complete integration and communication with other systems through this interface. The e-commerce API is the interface provided by major e-commerce platforms for developers to access platform data. At present, mainstream e-commerce platforms such as Taobao, Tmall, JD.com, and Suning all have their own APIs.
Taobao OpenAPI (Open application programming interface) is a set of REST open application programming interface. According to the basic e-commerce services provided by Taobao, Taobao abstracts and makes a series of API interfaces. Through these interfaces, external users can access Taobao's data and platform through programs. Taobao OpenAPI is an important part of Taobao's open platform and one of the three directions of Taobao's open platform - the main form of open business. Taobao OpenAPI is also called TOP (taobao open platform) (hereinafter referred to as top)
to develop programs based on openAPI, which is to use the API functions provided by Taobao to construct a URL, and use this URL to access Taobao’s data platform, and then the server will use your API Return the corresponding data, and the program will parse and display the data after receiving the data
public parameters
name | type | must | describe |
---|---|---|---|
key | String | yes | Call key (must be spliced in the URL in GET mode) to register Key and secret access |
secret | String | yes | call key |
api_name | String | yes | API interface name (included in the request address) [item_search, item_get, item_search_shop, etc.] |
cache | String | no | [yes, no] The default is yes, the cached data will be called, and the speed is relatively fast |
result_type | String | no | [json,jsonu,xml,serialize,var_export] returns the data format, the default is json, and the content output by jsonu can be read directly in Chinese |
lang | String | no | [cn,en,ru] translation language, default cn Simplified Chinese |
version | String | no | API version |
请求参数:num_iid=652874751412&is_promotion=1
参数说明:num_iid:淘宝商品ID
is_promotion:是否获取取促销价
Version: Date:2022-04-04
name | type | must | example value | describe |
---|---|---|---|---|
item |
item[] | 1 | baby details data | |
num_id |
Bigint | 1 | 520813250866 | Baby ID |
title |
String | 1 | Three-edged wood folding knife through security inspection creative mini keychain key knife saber portable multi-functional pocket knife free shipping | baby title |
desc_short |
String | 0 | Product Description | |
promotion_price |
Int | 0 | discounted price | |
price |
Float | 1 | 25.8 | price |
total_price |
Float | 0 | 0 | |
suggestive_price |
Float | 0 | 0 | |
orginal_price |
String | 0 | 25.80 | original price |
nick |
String | 0 | Happy Shopping Inn | Shopkeeper Nickname |
num |
Int | 0 | 3836 | in stock |
my_num |
Int | 0 | 0 | minimum purchase quantity |
detail_url |
String | 0 | http://item.taobao.com/item.htm?id=520813250866 | baby link |
pic_url |
String | 1 | //gd2.alicdn.com/imgextra/i4/2596264565/TB2p30elFXXXXXQXpXXXXXXXXXX_!!2596264565.jpg | baby pictures |
brand |
String | 0 | Sanbagi | brand name |
brandId |
Int | 0 | 8879363 | Brand ID |
rootCatId |
Int | 0 | 50013886 | Top Category ID |
cid |
Int | 1 | 50014822 | |
crumbs |
Mix | 0 | [] | Navigation menu |
created_time |
String | 0 | ||
modified_time |
String | 0 | ||
delist_time |
String | 0 | ||
desc |
String | 0 | product details | |
desc_img |
Mix | 0 | [] | Product detail image |
item_imgs |
Mix | 0 | item_imgs[] | product picture |
item_weight |
String | 0 | ||
item_size |
String | 0 | ||
location |
String | 0 | Shipping place | |
express_fee |
Float | 0 | 0.00 | Courier fees |
ems_fee |
Float | 0 | EMS fee | |
post_fee |
Float | 0 | Logistics costs | |
shipping_to |
String | 0 | ship to | |
has_discount |
Boolean | 0 | false | Is there a discount? |
video |
video[] | 0 | product video | |
is_virtual |
String | 0 | ||
is_promotion |
Boolean | 0 | false | Whether to promote |
props_name |
String | 0 | 1627207:1347647754:颜色分类:长方形带开瓶器+送工具刀卡+链子;1627207:1347647753:颜色分类:椭圆形带开瓶器+送工具刀卡+链子; | 商品属性名。格式为pid1:vid1:name1:value1;pid1:vid2:name2:value2。 |
prop_imgs |
prop_imgs[] | 0 | 商品属性图片列表 | |
property_alias |
String | 0 | 20509:9974422:36;1627207:28326:红色;20509:9975710:38;1627207:28326:红色;20509:9981357:40;1627207:28326:红色 | 销售属性值别名。格式为pid1:vid1:alias1;pid1:vid2:alia2。 |
props |
Mix | 0 | [{ "name": "产地","value": "中国" }] | 商品属性 |
total_sold |
Int | 0 | ||
skus |
skus[] | 0 | 商品规格信息列表 | |
seller_id |
Int | 0 | 2844096782 | 卖家ID |
sales |
Int | 0 | 138 | 销量 |
shop_id |
Int | 0 | 151372205 | 店铺ID |
props_list |
Mix | 0 | {20509:9974422: 尺码:36} | 商品属性 |
seller_info |
seller_info[] | 1 | 卖家信息 | |
tmall |
Boolean | 0 | false | 是否天猫 |
error |
String | 0 | 错误信息 | |
warning |
String | 0 | 警告信息 | |
url_log |
Mix | 0 | [] | |
favcount |
Int | 0 | 0 | |
fanscount |
Int | 0 | 0 | |
method |
String | 0 | item_tmall:pget_item | |
promo_type |
String | 0 | ||
props_img |
Mix | 0 | 1627207:28326": "//img.alicdn.com/imgextra/i2/2844096782/O1CN01VrjpXt1zyCc9DvERE_!!2844096782.jpg | 属性图片 |
shop_item |
Mix | 0 | [] | |
relate_items |
Mix | 0 | [] |
# 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/taobao/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=652874751412&is_promotion=1"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)
To sum up, the Taobao API interface is based on the Taobao open platform. Without the Taobao open platform, there would be no Taobao API interface. The Taobao API interface is more convenient, and it is a little helper for e-commerce companies to manage and obtain data (WeChat Anzexi58) . At the same time, cross-border e-commerce business can also be developed through the Taobao API interface.