Interactive Format Description

Created by Weebo Support, Modified on Fri, 17 Jun, 2022 at 2:10 AM by Weebo Support

1.1 Encoding Format

Unified use of UTF-8 encoding during interaction

 

1.2 Request Body

The request body format is a UTF-8 encoded JSON format string, such as:

{"number":"1","appId":"mylinl1"}

 

1.3 Request Header

User-Agent: openApi

Content-Type: application/json; charset=utf-8

Accept-encoding: gzip,deflate

Time-stamp: 1437528688233

Data-signature: BF706E6AC693BA3B1BABD32E6713431D

Time-stamp: Timestamp, which is the total number of milliseconds since January 1, 1970 (08:00:00 GMT) to the current time. It is also known as Unix Timestamp (Unix Timestamp)

Data-signature: the signature generated by the request body through the md5 algorithm

 

Java generation method

String data-signature = encryptToMd5String(JSONStr, appKey)

 

String encryptToMd5String(String content,String appKey)

{

     Return encryptToMd5String(

     StringUtils.trim (appKey)+StringUtils.trim(content));

}

 

String encryptToMd5String(String content)

{

     String md5String = null;

     MessageDigest md = MessageDigest.getInstance("md5");

     Md.update(content.getBytes("UTF-8"));

     md5String = parseByte2HexString(md.digest());

     Return md5String;

}

 

String parseByte2HexString(byte buf[])

{

     StringBuffer stringBuffer = new StringBuffer();

     For (int i = 0; i < buf.length; i++)

     {

          String hex = Integer.toHexString(buf[i] & 0xFF);

          If (hex.length() == 1) {hex = '0' + hex;}

          stringBuffer.append(hex.toUpperCase());

     }

     Return stringBuffer.toString();

}

 

PHP generation method

$signature = strtoupper(md5($appKey.$jsonData));

 

C# generation mode

FormsAuthentication.HashPasswordForStoringInConfigFile(appkey+jsonData, "MD5")

 

 

1.4 Response Body

The response body format is a UTF-8 encoded JSON format string, such as:

{"number":"1","appId":"mylinl1"}

 

1.5 Response Header

Data-signature: BF706E6AC693BA3B1BABD32E6713431D

Content-Type: application/json;charset=UTF-8

The way of generate Data-signature is the same way as the data-signature of the request header to ensure that the data is returned from the POS system.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article