Skip to content

Latest commit

 

History

History
578 lines (454 loc) · 18.1 KB

ContactsApi.md

File metadata and controls

578 lines (454 loc) · 18.1 KB

ContactsApi

All URIs are relative to https://api.messente.com/v1

Method HTTP request Description
addContactToGroup POST /phonebook/groups/{groupId}/contacts/{phone} Adds a contact to a group
createContact POST /phonebook/contacts Creates a new contact
deleteContact DELETE /phonebook/contacts/{phone} Deletes a contact
fetchContact GET /phonebook/contacts/{phone} Lists a contact
fetchContactGroups GET /phonebook/contacts/{phone}/groups Lists groups of a contact
fetchContacts GET /phonebook/contacts Returns all contacts
removeContactFromGroup DELETE /phonebook/groups/{groupId}/contacts/{phone} Removes a contact from a group
updateContact PATCH /phonebook/contacts/{phone} Updates a contact

addContactToGroup

Object addContactToGroup(groupId, phone)

Adds a contact to a group

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    String groupId = "5792a02a-e5c2-422b-a0a0-0ae65d814663"; // String | String in UUID format
    String phone = "+37251000000"; // String | A phone number
    try {
      Object result = apiInstance.addContactToGroup(groupId, phone);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#addContactToGroup");
      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
groupId String String in UUID format
phone String A phone number

Return type

Object

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 An empty object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing -
409 Contact already added to group -
0 General error -

createContact

ContactEnvelope createContact(contactFields)

Creates a new contact

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    ContactFields contactFields = new ContactFields(); // ContactFields | 
    try {
      ContactEnvelope result = apiInstance.createContact(contactFields);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#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
contactFields ContactFields

Return type

ContactEnvelope

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
409 Contact with phone already created -
0 General error -

deleteContact

deleteContact(phone)

Deletes a contact

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    String phone = "+37251000000"; // String | A phone number
    try {
      apiInstance.deleteContact(phone);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#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
phone String A phone number

Return type

null (empty response body)

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 Contact deleted -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
0 General error -

fetchContact

ContactEnvelope fetchContact(phone)

Lists a contact

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    String phone = "+37251000000"; // String | A phone number
    try {
      ContactEnvelope result = apiInstance.fetchContact(phone);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#fetchContact");
      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
phone String A phone number

Return type

ContactEnvelope

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -

fetchContactGroups

GroupListEnvelope fetchContactGroups(phone)

Lists groups of a contact

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    String phone = "+37251000000"; // String | A phone number
    try {
      GroupListEnvelope result = apiInstance.fetchContactGroups(phone);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#fetchContactGroups");
      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
phone String A phone number

Return type

GroupListEnvelope

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 An object containing a list of group objects -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -

fetchContacts

ContactListEnvelope fetchContacts(groupIds)

Returns all contacts

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    List<String> groupIds = Arrays.asList(); // List<String> | Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" 
    try {
      ContactListEnvelope result = apiInstance.fetchContacts(groupIds);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#fetchContacts");
      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
groupIds List<String> Optional one or many group id strings in UUID format. For example: &quot;/contacts?groupIds=group_id_one&groupIds=group_id_two&quot; [optional]

Return type

ContactListEnvelope

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 An object containing a list of contact objects -
400 Invalid &quot;groupIds&quot; parameters provided -
401 Unauthorized -
0 General error -

removeContactFromGroup

removeContactFromGroup(groupId, phone)

Removes a contact from a group

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    String groupId = "5792a02a-e5c2-422b-a0a0-0ae65d814663"; // String | String in UUID format
    String phone = "+37251000000"; // String | A phone number
    try {
      apiInstance.removeContactFromGroup(groupId, phone);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#removeContactFromGroup");
      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
groupId String String in UUID format
phone String A phone number

Return type

null (empty response body)

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 Contact removed from group -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing or contact is missing from group -
0 General error -

updateContact

ContactEnvelope updateContact(phone, contactUpdateFields)

Updates a contact

Example

// Import classes:
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.Configuration;
import com.messente.auth.*;
import com.messente.models.*;
import com.messente.api.ContactsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.messente.com/v1");
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuth.setUsername("YOUR USERNAME");
    basicAuth.setPassword("YOUR PASSWORD");

    ContactsApi apiInstance = new ContactsApi(defaultClient);
    String phone = "+37251000000"; // String | A phone number
    ContactUpdateFields contactUpdateFields = new ContactUpdateFields(); // ContactUpdateFields | 
    try {
      ContactEnvelope result = apiInstance.updateContact(phone, contactUpdateFields);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ContactsApi#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
phone String A phone number
contactUpdateFields ContactUpdateFields

Return type

ContactEnvelope

Authorization

basicAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 An object containing a contact object -
400 Invalid phone number or empty patch body or unknown fields provided -
401 Unauthorized -
404 Contact missing -
0 General error -