Building the API client library requires Maven to be installed.
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>com.getshoutout.shoutout.sdk</groupId>
<artifactId>shoutout-java-sdk</artifactId>
<version>7.0.1</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
compile "com.getshoutout.shoutout.sdk:shoutout-java-sdk:7.0.1"
At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/shoutout-java-sdk-7.0.1.jar
Please follow the installation instruction and execute the following Java code:
import com.getshoutout.shoutout.sdk.ApiClient;
import com.getshoutout.shoutout.sdk.Configuration;
import com.getshoutout.shoutout.sdk.api.MessagesApi;
import com.getshoutout.shoutout.sdk.auth.ApiKeyAuth;
import com.getshoutout.shoutout.sdk.model.Message;
import com.getshoutout.shoutout.sdk.model.MessageContent;
import com.getshoutout.shoutout.sdk.model.MessageResponse;
import java.util.Arrays;
public class MessagePost {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: ShoutOUTCustomAuthorizer
ApiKeyAuth ShoutOUTCustomAuthorizer = (ApiKeyAuth) defaultClient.getAuthentication("ShoutOUTCustomAuthorizer");
ShoutOUTCustomAuthorizer.setApiKeyPrefix("Apikey");
ShoutOUTCustomAuthorizer.setApiKey("YOUR API KEY");//Set Api Token
try {
MessagesApi api = new MessagesApi(defaultClient);
Message message = new Message();
MessageContent messageContent = new MessageContent();
messageContent.setSms("Hello, This is a test message"); //sms content
message.setContent(messageContent);
message.setDestinations(Arrays.asList("94771234567"));//mobile numbers to send the message
message.setSource("ShoutDEMO");//Sender Id
message.setTransports(Arrays.asList(Message.TransportsEnum.SMS));//Type of transport (SMS). More transports will come soon
MessageResponse response = api.sendMessage(message);
//Do your stuff with the response
System.out.println("Status:" + response.getStatus());
} catch (Exception e) {
e.printStackTrace();
}
}
}
All URIs are relative to https://amdimbh5tf.execute-api.us-east-1.amazonaws.com/v7
Class | Method | HTTP request | Description |
---|---|---|---|
ActivitiesApi | createActivity | POST /activities/records | |
ContactsApi | createOrReplaceContact | POST /contacts | |
ContactsApi | createOrReplaceContactList | POST /contacts/list | |
ContactsApi | createOrUpdateContact | PUT /contacts | |
ContactsApi | createOrUpdateContactList | PUT /contacts/list | |
MessagesApi | sendMessage | POST /messages |
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issue.