Menu

Open API Protocol

1.Request Instructions

  • Interface is case sensitive
  • The request of the interface needs to generate the correct sign before it can be successfully called
  • QPM frequency limit is 10, more than 10 requests in a minute will return "request too frequent", you need to wait for the next minute to request again


2.Common Request Parameters

  • Header
FileParameterRequired
Content-Typeapplication/jsonY


  • Body
ParameterTypeRequiredInstruction
client_idstringYPlease contact your admin or sub-admin to obtain it and ensure Open API permissions have been activated.
timestampintYunix timestamp when requested
signstringYmd5(client_secret+timestamp)
………………other parameter


  • Request Example
{
    "client_id": "xxx",
    "timestamp": 1608776690,
     "sign": "05d481dc241a7a1daa5b2a7fa2b51dc5",
    "...": "..."
}


3. About "sign"

  • Pass client_id, timestamp, sign in the request parameters to pass the authentication, and "sign" is generated by "client_secret" and "timestamp" according to the encryption rules.
  • Encryption rule is md5(client_secret + timestamp).
  • The default validity period of timestamp is 30s. If it exceeds 30s, an interface timeout will be reported.
  • You shall inquiry to your admin or sub-admin for the "client_id" and "client_secret" mentioned above. The API Token Management entry is located in the personal profile at the top right corner of the platform.


4.Sample Codes of "sign"

//java Sample

import org.apache.commons.codec.digest.DigestUtils;

public static String getSign(String clientSecret) {
	long timestamp = System.currentTimeMillis()/1000;
	String oriSign = clientSecret + timestamp;
	String sign = DigestUtils.md5Hex(oriSign);
	return sign;
}



//python Sample

import hashlib
import time

def get_sign(clientSecret):  
	timestamp = int(time.time())
	oriSign = clientSecret+str(timestamp)    
	encodeSign = str(oriSign).encode()  
	sign = hashlib.md5(encodeSign)
	return sign.hexdigest()


	
//php Sample

function getSign($clientSecret)
{
	$timestamp = time();
	$oriSign = $clientSecret . $timestamp;
	$sign = md5($oriSign);
	return $sign;
}



//go Sample

import (
	"time"
	"strconv"
	"app/util/encrypt"
)

func getSign(clientSecret string) string {
	timestamp := time.Now().Unix()
	sign := encrypt.Md5(fmt.Sprintf("%s%s", clientSecret, strconv.FormatInt(timestamp, 10)))
	return sign
}


5.Status Description

Error codeDescription
0success
-1error
400001error request parameter


Previous
XMP Open API
Next
Ad Report API
Last modified: 2024-11-20Powered by