Alimama commission conversion API interface (item_id-commission conversion) interface code docking tutorial is as follows:
1. Public parameters
name | type | must | Description (interface code tutorial wx19970108018) |
---|---|---|---|
key | String | yes | Call key (must be spliced in the URL in GET mode, click to get the request key and secret ) |
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 |
2. Request parameters
请求参数:id=40948381564&pid=mm_1409800143_2028300495_110837200055&tbname=oneboundcn&hasiteminfo=&extsearch=&tpwd=&shorturl=
参数说明:*id:淘宝天猫的商品ID
*pid:pid
*tbname:淘宝昵称
hasiteminfo:是否输出商品信息,双十一期间不建议启用,1=启用,0=不启用
extsearch:官方查不到券时是否去第三方平台查询,1为启用
tpwd:是否生成淘口令,1为生成,不填则不生成
shorturl:是否需要短链接,1为生成,不填则不生成
3. Request example (CURL, PHP, PHPsdk, Java, C#, Python...)
# 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://wx19970108018/alimama/item_id/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&id=40948381564&pid=mm_1409800143_2028300495_110837200055&tbname=oneboundcn&hasiteminfo=&extsearch=&tpwd=&shorturl="
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)