The Java demo of Taobao open platform may require frequently-used URLs and some basic parameter descriptions

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.