API Invoke Methods
Open Platform API is invoking by HTTP Method,API is using REST Style,developers should assemble the HTTP Request according a certain format to invoke API,you can refer to example code for details.
一,Invoke Parameters
When invoking API ,you must input the systematic and applied parameters.
1)Systematic Parameters detailed instruction:
| Name | Type | Required | Description | 
|---|---|---|---|
| method | string | Y | API Name | 
| timestamp | string | Y | timestamp,the format is 'yyyy-mm-dd HH:mm:ss', Example:2015-01-10 12:51:13.The time error between the Server and Client is in 10 minutes. | 
| format | string | N | selectable, assign the response format. Optional value: json | 
| app_key | string | Y | AppKey of the Appllication need applying us. | 
| v | string | Y | API Agreement Version,optional value:1.0 . | 
| sign | string | Y | getting by md5 encrypt to API calling paramters (apart this 'sign'). You can refer to 3)sign | 
| sign_method | string | N | selectable,the encryption method of the params,optional value:md5 | 
| access_token | string | Y | getting the Access Token value by authorization | 
2)Applied Paramters,please refer to the API Params Instruction.
3)sign
When calling an API to server ,need SIGN Verify to the request params.Here is the example:
accorgin params name(apart sign and image),sort all the request params by alphabetic order:key + value....key+value
Example:sort foo=1,bar=2,baz=3 to bar=2,baz=3,foo=1, splice the params name and value then get the string bar2baz3foo1 splice secretKey to the start and end of params sting.
Example:secretKey value is secret123, you will get this string :secret123bar2baz3foo1secret123 , and then upper it after md5 encryption.
JAVA Instance Code:
     //signContent   is the string to be encrypted after the splice
     String sign= "";
     try {
          MessageDigest md = MessageDigest.getInstance("MD5");
          md.update(signContent.getBytes("UTF-8"));
          byte[] byteData = md.digest();
          StringBuilder sb = new StringBuilder();
          for(int b : byteData){
              b = b&0xFF;
              if(b<16)
                  sb.append('0');
             sb.append(Integer.toHexString(b));
          }
          sign= sb.toString().toUpperCase();
      } catch (Exception e) {
        e.printStackTrace();
      }
二,Splice the HTTP Request
 all params is convert by UTF-8 .
 Query API  request by  GET  Method,Modification API request by the POST Method.
 Order kind request invoke [http://wop.wangjubao.com/rest/trade](http://wop.wangjubao.com/rest/trade)
 Member kind request invoke[http://wop.wangjubao.com/rest/buyer](http://wop.wangjubao.com/rest/buyer)
 Grouping kind request invoke[http://wop.wangjubao.com/rest/buyergroup](http://wop.wangjubao.com/rest/buyergroup)
 Tag kind request invoke[http://wop.wangjubao.com/rest/buyerlabel](http://wop.wangjubao.com/rest/buyerlabel)
 Integration kind request invoke[http://wop.wangjubao.com/rest/jifen](http://wop.wangjubao.com/rest/jifen)
 Marketing kind request invoke [http://wop.wangjubao.com/rest/ump](http://wop.wangjubao.com/rest/ump)
 Shopcart kind request invoke[http://wop.wangjubao.com/rest/shopcart](http://wop.wangjubao.com/rest/shopcart)
 Favourite kind request invoke[http://wop.wangjubao.com/rest/favor](http://wop.wangjubao.com/rest/favor)
三,Error Code
| error code | error description | solution | 
|---|---|---|
| 80001 | not found AppKey | input AppKey when request | 
| 80002 | useless AppKey | apply for useful ppKey | 
| 80003 | useless time parames | use the current time to request again; if the error between system time and server,adjust your system time. | 
| 80004 | not found sign | sign the request params according to agreement | 
| 80005 | sign check failure | inspect AppKey and SecretKey ,check the sign creating method | 
| 80006 | request not assign one API method | assign one Api method | 
| 80007 | request unexpected method | check the request method is defined in API | 
| 80008 | not found Access Token | input Access Token | 
| 80009 | useless Access Token | input useful Access Token | 
| 81001 | request error | server is busy and can't accept new request | 
| 81002 | params error | check the API method invoking params | 
| 81003 | method execute failure | retry request |