Skip to content

sendx/sendx-java-sdk

Repository files navigation

SendX Java SDK

Introduction

SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations.

The SendX API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The SendX Rest API doesn’t support bulk updates. You can work on only one object per request.

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>io.sendx</groupId>
  <artifactId>sendx-java-sdk</artifactId>
  <version>1.0.1</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'sendx-java-sdk' jar has been published to maven central.
    mavenLocal()       // Needed if the 'sendx-java-sdk' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "io.sendx:sendx-java-sdk:1.0.1"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/sendx-java-sdk-1.0.1.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import sendx_java_sdk.ApiClient;
import sendx_java_sdk.ApiException;
import sendx_java_sdk.Configuration;
import sendx_java_sdk.auth.*;
import sendx_java_sdk.models.*;
import sendx_java_sdk.CampaignApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.sendx.io/api/v1/rest");
    
    // Configure API key authorization: apiKeyAuth
    ApiKeyAuth apiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("apiKeyAuth");
    apiKeyAuth.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //apiKeyAuth.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    ContactRequest contactRequest = new ContactRequest(); // ContactRequest | 
    contactRequest.setFirstName("John")
    contactRequest.setLastName("Doe")
    contactRequest.setEmail("john.doe@sendx.io")
    contactRequest.setCompany("SendX")
    contactRequest.setLastTrackedIp("32.342.12.322")

    // Set tags as a list of strings
    List<String> tags = Arrays.asList("sner1jin3ij34b4", "234bjk2n42ednj32";
    contactRequest.setTags(tags)

    try {
      OperationResponse result = apiInstance.createContact(contactRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CampaignApi#createCampaign");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to https://api.sendx.io/api/v1/rest

Class Method HTTP request Description
CampaignApi createCampaign POST /campaign Create Campaign
CampaignApi deleteCampaign DELETE /campaign/{campaignId} Delete Campaign
CampaignApi editCampaign PUT /campaign/{campaignId} Edit Campaign
CampaignApi getAllCampaigns GET /campaign Get All Campaigns
CampaignApi getCampaignById GET /campaign/{campaignId} Get Campaign By Id
ContactApi createContact POST /contact Create a contact
ContactApi deleteContact DELETE /contact/{identifier} Delete Contact
ContactApi getAllContacts GET /contact Get All Contacts
ContactApi getContactById GET /contact/{identifier} Get Contact by Identifier
ContactApi unsubscribeContact POST /contact/unsubscribe/{identifier} Unsubscribe Contact
ContactApi updateContact PUT /contact/{identifier} Update Contact
EventApi createRevenueEvent POST /events/revenue Record a revenue event for a specific contact
EventApi pushCustomEvent POST /events/custom Push a custom event associated with a contact
GettingStartedApi identifyContact POST /contact/identify Identify contact
GettingStartedApi trackingContact POST /contact/track Add Tracking info
ListApi createList POST /list Create List
ListApi deleteList DELETE /list/{listId} Delete List
ListApi getAllLists GET /list Get All Lists
ListApi getListById GET /list/{listId} Get List
ListApi updateList PUT /list/{listId} Update List
ReportsApi getCampaignReport GET /report/campaign/{campaignId} Get CampaignReport Data
SenderApi createSender POST /sender Create Sender
SenderApi getAllSenders GET /sender Get All Senders
TagsApi createTag POST /tag Create a Tag
TagsApi deleteTag DELETE /tag/{tagId} Delete a Tag
TagsApi getAllTags GET /tag Get All Tags
TagsApi getTagById GET /tag/{tagId} Get a Tag by ID
TagsApi updateTag PUT /tag/{tagId} Update a Tag

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

apiKeyAuth

  • Type: API key
  • API key parameter name: X-Team-ApiKey
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

support@sendx.io

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages