Java SDK


The Uni Java SDK is hosted by Maven and is available from the public Maven repository.

Add the Maven dependency to the project using the following code:


or use Gradle:

implementation "com.apistd.uni:uni-sdk:0.0.4"


The following example shows how to use the Uni Java SDK to quickly invoke a service.

Send an SMS

import com.apistd.uni.Uni;
import com.apistd.uni.UniException;
import com.apistd.uni.UniResponse;
import com.apistd.uni.sms.UniSMS;
import com.apistd.uni.sms.UniMessage;

import java.util.HashMap;
import java.util.Map;

public class Example {
    public static String ACCESS_KEY_ID = "your access key id";
    private static String ACCESS_KEY_SECRET = "your access key secret";

    public static void main(String[] args) {
        // initialization
        Uni.init(ACCESS_KEY_ID, ACCESS_KEY_SECRET); // if you use the simple auth mode, just pass in the first parameter
        Uni.setEndpoint(""); // set endpoint

        // set custom parameters (variable SMS)
        Map<String, String> templateData = new HashMap<String, String>();
        templateData.put("code", "6666");

        // build a message
        UniMessage message = UniSMS.buildMessage()
            .setTo("your phone number")

        // send the message
        try {
            UniResponse res = message.send();
        } catch (UniException e) {
            System.out.println("Error: " + e);
            System.out.println("RequestId: " + e.requestId);