API reference:
Http://open.taobao.com/api_tool/api_test.html
User authorization code:
Http://open.taobao.com/isv/authorize.php? Appkey = {util. app_key}
Public test account:
Http://open.taobao.com/api_tool/taobaoPubAccount.html
Password: taobao1234
Appkey ==> authcode ==> sessionkey
Refer to the following code to describe the differences between the preceding parameters (the needsession. Java is also described below)
Http://wiki.open.taobao.com/index.php/%E8%8E%B7%E5%8F%96%E5%BA%94%E7%94%A8%E4%B8%8A%E4%B8%8B%E6%96%87%E5%92%8CSessionKey
Development document Portal:
Http://wiki.open.taobao.com/index.php/%E9%A6%96%E9%A1%B5
Util. Java encapsulates shared classes.
Public static string sign (treemap <string, string> Params, string secret)
Note: parameters uploaded by the user, including method, app_key, timestamp, format, and V, are used as Params, and app_sercet corresponding to the appkey applied by the user is used as secret, the stacked factor is encrypted with MD5 to obtain the sign signature.
Public static string getresult (string urlstr, string content)
Note: Based on the URL to be submitted, and the content of the uploaded parameter, feedback is obtained. This method can also be applied to any website.
Noneedsession. Java, no session operation required
/*
* Assemble request parameters (Product Information)
*/
Private string createrequestparam ()
Note: This method encapsulates basic parameters, including
Method: The name of the specified API method, for example, Taobao. taobake. Items. Get,
App_key: appkey applied by the user
Timestamp: postmark. As a dynamic parameter, it can ensure the uniqueness of sign generation.
Format: XML, JSON.
Public String geturl ()
Note: dynamically assemble URL addresses: mainly submitted addresses sandbox_url + createrequestparam ().
Needsession. Java requires a session
Note: authcode is obtained from appkey through the following address (with a 10-minute validity period)
Http://auth.open.taobao.com/authorize? Appkey = {appkey}
Then obtain the sessionkey Based on the authcode.
Http://container.api.tbsandbox.com/container? Authcode =. I often see
But sometimes it's okay again.
/*
* Obtain the sessionkey.
*/
Private string getsessionkey (string authkey)
English version (through the http://container.api.tbsandbox.com/container? Authcode =. A connection address will be returned, including: top_session = parameter. This method is used to obtain this value.