Skip to content

Latest commit

 

History

History
460 lines (360 loc) · 18.6 KB

File metadata and controls

460 lines (360 loc) · 18.6 KB

ContactApi

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

Method HTTP request Description
createContact POST /contact Create a new contact
deleteContact DELETE /contact/{identifier} Delete contact
getAllContacts GET /contact Get all contacts
getContact GET /contact/{identifier} Get contact by ID
unsubscribeContact POST /contact/unsubscribe/{identifier} Unsubscribe contact
updateContact PUT /contact/{identifier} Update contact

createContact

RestRContact createContact(restEContact)

Create a new contact

Creates a new contact in your SendX team with the provided information. 🎯 Key Features: - Email validation and duplicate detection - Automatic relationship building with lists and tags - Smart custom field handling 📋 Business Rules: - Email is mandatory and must be unique within the team - Last tracked IP is stored for analytics

Example

// 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.ContactApi;

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: TeamApiKey
    ApiKeyAuth TeamApiKey = (ApiKeyAuth) defaultClient.getAuthentication("TeamApiKey");
    TeamApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //TeamApiKey.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    RestEContact restEContact = new RestEContact(); // RestEContact | 
    try {
      RestRContact result = apiInstance.createContact(restEContact);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactApi#createContact");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
restEContact RestEContact

Return type

RestRContact

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 ✅ Contact created successfully -
400 ❌ Bad Request - Invalid input data -
401 ❌ Unauthorized - Invalid or missing API key -
409 ❌ Conflict - Resource already exists -
422 ❌ Unprocessable Entity - Invalid request format -
500 ❌ Internal Server Error - System error occurred -

deleteContact

DeleteResponse deleteContact(identifier)

Delete contact

Soft deletes a contact from your team. 🎯 Key Features: - Soft delete preserves data - Removes from all lists - Cancels pending campaigns - Maintains historical data

Example

// 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.ContactApi;

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: TeamApiKey
    ApiKeyAuth TeamApiKey = (ApiKeyAuth) defaultClient.getAuthentication("TeamApiKey");
    TeamApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //TeamApiKey.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    String identifier = "contact_BnKjkbBBS500CoBCP0oChQ"; // String | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 
    try {
      DeleteResponse result = apiInstance.deleteContact(identifier);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactApi#deleteContact");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
identifier String Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Return type

DeleteResponse

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 ✅ Contact deleted successfully -
400 ❌ Bad Request - Invalid input data -
401 ❌ Unauthorized - Invalid or missing API key -
404 ❌ Not Found - Resource does not exist -
500 ❌ Internal Server Error - System error occurred -

getAllContacts

List<RestRContact> getAllContacts(offset, limit, search)

Get all contacts

Retrieves a paginated list of all contacts in your team with optional filtering capabilities. 🎯 Key Features: - Pagination support with offset/limit - Search contacts by name or email - All relationships included (lists, tags, custom fields) - Prefixed IDs for easy integration 📊 Pagination: - Default limit: 10 contacts per page - Maximum limit: 100 contacts per page - Use offset for page navigation 🔍 Search: - Searches across firstName, lastName, and email fields - Case-insensitive partial matching - Combine with pagination for large datasets

Example

// 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.ContactApi;

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: TeamApiKey
    ApiKeyAuth TeamApiKey = (ApiKeyAuth) defaultClient.getAuthentication("TeamApiKey");
    TeamApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //TeamApiKey.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    Integer offset = 0; // Integer | Number of records to skip for pagination.  **Examples:** - `0` - First page (default) - `50` - Second page (with limit=50) - `100` - Third page (with limit=50) 
    Integer limit = 50; // Integer | Maximum number of records to return.  **Constraints:** - Minimum: 1 - Maximum: 100 - Default: 10 
    String search = "john"; // String | Search term to filter contacts by name or email.  **Search Behavior:** - Searches firstName, lastName, and email fields - Case-insensitive partial matching - Minimum 2 characters for search  **Examples:** - `john` - Finds \"John Doe\", \"johnson@example.com\" - `@company.com` - Finds all emails from company.com - `smith` - Finds \"John Smith\", \"smith@email.com\" 
    try {
      List<RestRContact> result = apiInstance.getAllContacts(offset, limit, search);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactApi#getAllContacts");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
offset Integer Number of records to skip for pagination. Examples: - `0` - First page (default) - `50` - Second page (with limit=50) - `100` - Third page (with limit=50) [optional] [default to 0]
limit Integer Maximum number of records to return. Constraints: - Minimum: 1 - Maximum: 100 - Default: 10 [optional] [default to 50]
search String Search term to filter contacts by name or email. Search Behavior: - Searches firstName, lastName, and email fields - Case-insensitive partial matching - Minimum 2 characters for search Examples: - `john` - Finds &quot;John Doe&quot;, &quot;johnson@example.com&quot; - `@company.com` - Finds all emails from company.com - `smith` - Finds &quot;John Smith&quot;, &quot;smith@email.com&quot; [optional]

Return type

List<RestRContact>

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 ✅ Contacts retrieved successfully -
400 ❌ Bad Request - Invalid input data -
401 ❌ Unauthorized - Invalid or missing API key -
500 ❌ Internal Server Error - System error occurred -

getContact

RestRContact getContact(identifier)

Get contact by ID

Retrieves detailed information about a specific contact. 🎯 Key Features: - Returns complete contact profile - Includes all lists and tags - Shows custom field values - Provides engagement metrics

Example

// 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.ContactApi;

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: TeamApiKey
    ApiKeyAuth TeamApiKey = (ApiKeyAuth) defaultClient.getAuthentication("TeamApiKey");
    TeamApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //TeamApiKey.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    String identifier = "contact_BnKjkbBBS500CoBCP0oChQ"; // String | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 
    try {
      RestRContact result = apiInstance.getContact(identifier);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactApi#getContact");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
identifier String Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Return type

RestRContact

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 ✅ Contact retrieved successfully -
400 ❌ Bad Request - Invalid input data -
401 ❌ Unauthorized - Invalid or missing API key -
404 ❌ Not Found - Resource does not exist -
500 ❌ Internal Server Error - System error occurred -

unsubscribeContact

MessageResponse unsubscribeContact(identifier)

Unsubscribe contact

Unsubscribes a contact from all marketing communications. 🎯 Key Features: - Marks contact as unsubscribed - Removes from all active campaigns - Maintains unsubscribe history - Complies with anti-spam regulations

Example

// 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.ContactApi;

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: TeamApiKey
    ApiKeyAuth TeamApiKey = (ApiKeyAuth) defaultClient.getAuthentication("TeamApiKey");
    TeamApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //TeamApiKey.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    String identifier = "contact_BnKjkbBBS500CoBCP0oChQ"; // String | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 
    try {
      MessageResponse result = apiInstance.unsubscribeContact(identifier);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactApi#unsubscribeContact");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
identifier String Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Return type

MessageResponse

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 ✅ Contact unsubscribed successfully -
400 ❌ Bad Request - Invalid input data -
401 ❌ Unauthorized - Invalid or missing API key -
404 ❌ Not Found - Resource does not exist -
500 ❌ Internal Server Error - System error occurred -

updateContact

RestRContact updateContact(identifier, restEContact)

Update contact

Updates an existing contact's information. 🎯 Key Features: - Partial updates supported - Add/remove lists and tags - Update custom fields - Change email address

Example

// 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.ContactApi;

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: TeamApiKey
    ApiKeyAuth TeamApiKey = (ApiKeyAuth) defaultClient.getAuthentication("TeamApiKey");
    TeamApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //TeamApiKey.setApiKeyPrefix("Token");

    ContactApi apiInstance = new ContactApi(defaultClient);
    String identifier = "contact_BnKjkbBBS500CoBCP0oChQ"; // String | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 
    RestEContact restEContact = new RestEContact(); // RestEContact | 
    try {
      RestRContact result = apiInstance.updateContact(identifier, restEContact);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactApi#updateContact");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
identifier String Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`
restEContact RestEContact

Return type

RestRContact

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 ✅ Contact updated successfully -
400 ❌ Bad Request - Invalid input data -
401 ❌ Unauthorized - Invalid or missing API key -
404 ❌ Not Found - Resource does not exist -
409 ❌ Conflict - Resource already exists -
422 ❌ Unprocessable Entity - Invalid request format -
500 ❌ Internal Server Error - System error occurred -