Skip to content

MailSlurp\ContactControllerApi

All URIs are relative to https://php.api.mailslurp.com.

Method HTTP request Description
createContact() POST /contacts Create a contact
deleteContact() DELETE /contacts/{contactId} Delete contact
getAllContacts() GET /contacts/paginated Get all contacts
getContact() GET /contacts/{contactId} Get contact
getContactVCard() GET /contacts/{contactId}/download Get contact vCard vcf file
getContacts() GET /contacts Get all contacts

createContact()

createContact($create_contact_options): MailSlurpModelsContactDto

Create a contact

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiContactControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$create_contact_options = new MailSlurpModelsCreateContactOptions(); // MailSlurpModelsCreateContactOptions

try {
    $result = $apiInstance->createContact($create_contact_options);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactControllerApi->createContact: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
create_contact_options MailSlurpModelsCreateContactOptions

Return type

MailSlurpModelsContactDto

Authorization

API_KEY

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to ]

deleteContact()

deleteContact($contact_id)

Delete contact

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiContactControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$contact_id = 'contact_id_example'; // string

try {
    $apiInstance->deleteContact($contact_id);
} catch (Exception $e) {
    echo 'Exception when calling ContactControllerApi->deleteContact: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
contact_id string

Return type

void (empty response body)

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getAllContacts()

getAllContacts($page, $size, $sort, $since, $before): MailSlurpModelsPageContactProjection

Get all contacts

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiContactControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$page = 0; // int | Optional page  in list pagination
$size = 20; // int | Optional page size in list pagination
$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC
$since = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Filter by created at after the given timestamp
$before = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Filter by created at before the given timestamp

try {
    $result = $apiInstance->getAllContacts($page, $size, $sort, $since, $before);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactControllerApi->getAllContacts: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
page int Optional page in list pagination [optional] [default to 0]
size int Optional page size in list pagination [optional] [default to 20]
sort string Optional createdAt sort direction ASC or DESC [optional] [default to 'ASC']
since DateTime Filter by created at after the given timestamp [optional]
before DateTime Filter by created at before the given timestamp [optional]

Return type

MailSlurpModelsPageContactProjection

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getContact()

getContact($contact_id): MailSlurpModelsContactDto

Get contact

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiContactControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$contact_id = 'contact_id_example'; // string

try {
    $result = $apiInstance->getContact($contact_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactControllerApi->getContact: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
contact_id string

Return type

MailSlurpModelsContactDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getContactVCard()

getContactVCard($contact_id): string[]

Get contact vCard vcf file

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiContactControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$contact_id = 'contact_id_example'; // string

try {
    $result = $apiInstance->getContactVCard($contact_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactControllerApi->getContactVCard: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
contact_id string

Return type

string[]

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getContacts()

getContacts(): MailSlurpModelsContactProjection[]

Get all contacts

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiContactControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);

try {
    $result = $apiInstance->getContacts();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactControllerApi->getContacts: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

MailSlurpModelsContactProjection[]

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]