|
| 1 | +# SendX PHP SDK |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +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. |
| 6 | + |
| 7 | +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. |
| 8 | +The SendX Rest API doesn’t support bulk updates. You can work on only one object per request. <br> |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## Installation & Usage |
| 13 | + |
| 14 | +### Requirements |
| 15 | + |
| 16 | +PHP 7.4 and later. |
| 17 | +Should also work with PHP 8.0. |
| 18 | + |
| 19 | +### Composer |
| 20 | + |
| 21 | +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: |
| 22 | + |
| 23 | +```json |
| 24 | +{ |
| 25 | + "repositories": [ |
| 26 | + { |
| 27 | + "type": "vcs", |
| 28 | + "url": "https://github.com/sendx/sendx-php-sdk.git" |
| 29 | + } |
| 30 | + ], |
| 31 | + "require": { |
| 32 | + "sendx/sendx-php-sdk": "*@dev" |
| 33 | + } |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +Then run `composer install` |
| 38 | + |
| 39 | +### Manual Installation |
| 40 | + |
| 41 | +Download the files and include `autoload.php`: |
| 42 | + |
| 43 | +```php |
| 44 | +<?php |
| 45 | +require_once('/path/to/sendx/vendor/autoload.php'); |
| 46 | +``` |
| 47 | + |
| 48 | +## Getting Started |
| 49 | + |
| 50 | +Please follow the [installation procedure](#installation--usage) and then run the following: |
| 51 | + |
| 52 | +```php |
| 53 | +<?php |
| 54 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +// Configure API key authorization: apiKeyAuth |
| 59 | +$config = sendx\Configuration::getDefaultConfiguration()->setApiKey('X-Team-ApiKey', 'YOUR_API_KEY'); |
| 60 | +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
| 61 | +// $config = sendx\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Team-ApiKey', 'Bearer'); |
| 62 | + |
| 63 | + |
| 64 | +$apiInstance = new sendx\Api\CampaignApi( |
| 65 | + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. |
| 66 | + // This is optional, `GuzzleHttp\Client` will be used as default. |
| 67 | + new GuzzleHttp\Client(), |
| 68 | + $config |
| 69 | +); |
| 70 | +$campaign_request = new \sendx\model\CampaignRequest(); // \sendx\model\CampaignRequest | The campaign content |
| 71 | + |
| 72 | +try { |
| 73 | + $result = $apiInstance->createCampaign($campaign_request); |
| 74 | + print_r($result); |
| 75 | +} catch (Exception $e) { |
| 76 | + echo 'Exception when calling CampaignApi->createCampaign: ', $e->getMessage(), PHP_EOL; |
| 77 | +} |
| 78 | + |
| 79 | +``` |
| 80 | + |
| 81 | +## API Endpoints |
| 82 | + |
| 83 | +All URIs are relative to *https://api.sendx.io/api/v1/rest* |
| 84 | + |
| 85 | +Class | Method | HTTP request | Description |
| 86 | +------------ | ------------- | ------------- | ------------- |
| 87 | +*CampaignApi* | [**createCampaign**](docs/Api/CampaignApi.md#createcampaign) | **POST** /campaign | Create Campaign |
| 88 | +*CampaignApi* | [**deleteCampaign**](docs/Api/CampaignApi.md#deletecampaign) | **DELETE** /campaign/{campaignId} | Delete Campaign |
| 89 | +*CampaignApi* | [**editCampaign**](docs/Api/CampaignApi.md#editcampaign) | **PUT** /campaign/{campaignId} | Edit Campaign |
| 90 | +*CampaignApi* | [**getAllCampaigns**](docs/Api/CampaignApi.md#getallcampaigns) | **GET** /campaign | Get All Campaigns |
| 91 | +*CampaignApi* | [**getCampaignById**](docs/Api/CampaignApi.md#getcampaignbyid) | **GET** /campaign/{campaignId} | Get Campaign By Id |
| 92 | +*ContactApi* | [**createContact**](docs/Api/ContactApi.md#createcontact) | **POST** /contact | Create a contact |
| 93 | +*ContactApi* | [**deleteContact**](docs/Api/ContactApi.md#deletecontact) | **DELETE** /contact/{contactId} | Delete Contact |
| 94 | +*ContactApi* | [**getAllContacts**](docs/Api/ContactApi.md#getallcontacts) | **GET** /contact | Get All Contacts |
| 95 | +*ContactApi* | [**getContactById**](docs/Api/ContactApi.md#getcontactbyid) | **GET** /contact/{contactId} | Get Contact by ID |
| 96 | +*ContactApi* | [**unsubscribeContact**](docs/Api/ContactApi.md#unsubscribecontact) | **POST** /contact/unsubscribe/{contactId} | Unsubscribe Contact |
| 97 | +*ContactApi* | [**updateContact**](docs/Api/ContactApi.md#updatecontact) | **PUT** /contact/{contactId} | Update Contact |
| 98 | +*ListApi* | [**createList**](docs/Api/ListApi.md#createlist) | **POST** /list | Create List |
| 99 | +*ListApi* | [**deleteList**](docs/Api/ListApi.md#deletelist) | **DELETE** /list/{listId} | Delete List |
| 100 | +*ListApi* | [**getAllLists**](docs/Api/ListApi.md#getalllists) | **GET** /list | Get All Lists |
| 101 | +*ListApi* | [**getListById**](docs/Api/ListApi.md#getlistbyid) | **GET** /list/{listId} | Get List |
| 102 | +*ListApi* | [**updateList**](docs/Api/ListApi.md#updatelist) | **PUT** /list/{listId} | Update List |
| 103 | +*ReportsApi* | [**getCampaignReport**](docs/Api/ReportsApi.md#getcampaignreport) | **GET** /report/campaign/{campaignId} | Get CampaignReport Data |
| 104 | +*SenderApi* | [**createSender**](docs/Api/SenderApi.md#createsender) | **POST** /sender | Create Sender |
| 105 | +*SenderApi* | [**getAllSenders**](docs/Api/SenderApi.md#getallsenders) | **GET** /sender | Get All Senders |
| 106 | +*TagsApi* | [**createTag**](docs/Api/TagsApi.md#createtag) | **POST** /tag | Create a Tag |
| 107 | +*TagsApi* | [**deleteTag**](docs/Api/TagsApi.md#deletetag) | **DELETE** /tag/{tagId} | Delete a Tag |
| 108 | +*TagsApi* | [**getAllTags**](docs/Api/TagsApi.md#getalltags) | **GET** /tag | Get All Tags |
| 109 | +*TagsApi* | [**getTagById**](docs/Api/TagsApi.md#gettagbyid) | **GET** /tag/{tagId} | Get a Tag by ID |
| 110 | +*TagsApi* | [**updateTag**](docs/Api/TagsApi.md#updatetag) | **PUT** /tag/{tagId} | Update a Tag |
| 111 | + |
| 112 | +## Models |
| 113 | + |
| 114 | +- [Campaign](docs/Model/Campaign.md) |
| 115 | +- [CampaignDashboardData](docs/Model/CampaignDashboardData.md) |
| 116 | +- [CampaignRequest](docs/Model/CampaignRequest.md) |
| 117 | +- [Contact](docs/Model/Contact.md) |
| 118 | +- [ContactRequest](docs/Model/ContactRequest.md) |
| 119 | +- [CreateResponse](docs/Model/CreateResponse.md) |
| 120 | +- [DashboardStats](docs/Model/DashboardStats.md) |
| 121 | +- [DeleteCampaign200Response](docs/Model/DeleteCampaign200Response.md) |
| 122 | +- [DeleteRequest](docs/Model/DeleteRequest.md) |
| 123 | +- [DeleteResponse](docs/Model/DeleteResponse.md) |
| 124 | +- [LastSentCampaignStat](docs/Model/LastSentCampaignStat.md) |
| 125 | +- [ListModel](docs/Model/ListModel.md) |
| 126 | +- [ListRequest](docs/Model/ListRequest.md) |
| 127 | +- [ReportData](docs/Model/ReportData.md) |
| 128 | +- [Response](docs/Model/Response.md) |
| 129 | +- [Sender](docs/Model/Sender.md) |
| 130 | +- [SenderRequest](docs/Model/SenderRequest.md) |
| 131 | +- [SenderResponse](docs/Model/SenderResponse.md) |
| 132 | +- [Tag](docs/Model/Tag.md) |
| 133 | +- [TagRequest](docs/Model/TagRequest.md) |
| 134 | + |
| 135 | +## Authorization |
| 136 | + |
| 137 | +Authentication schemes defined for the API: |
| 138 | +### apiKeyAuth |
| 139 | + |
| 140 | +- **Type**: API key |
| 141 | +- **API key parameter name**: X-Team-ApiKey |
| 142 | +- **Location**: HTTP header |
| 143 | + |
| 144 | + |
| 145 | +## Tests |
| 146 | + |
| 147 | +To run the tests, use: |
| 148 | + |
| 149 | +```bash |
| 150 | +composer install |
| 151 | +vendor/bin/phpunit |
| 152 | +``` |
| 153 | + |
| 154 | +## Author |
| 155 | + |
| 156 | +support@sendx.io |
| 157 | + |
0 commit comments