All URIs are relative to https://api.elasticemail.com/v4
| Method | HTTP request | Description |
|---|---|---|
| segmentsByNameDelete | DELETE /segments/{name} | Delete Segment |
| segmentsByNameGet | GET /segments/{name} | Load Segment |
| segmentsByNamePut | PUT /segments/{name} | Update Segment |
| segmentsGet | GET /segments | Load Segments |
| segmentsPost | POST /segments | Add Segment |
segmentsByNameDelete(name)
Delete Segment
Delete an existing segment. Required Access Level: ModifyContacts
import ElasticEmail from '@elasticemail/elasticemail-client';
let defaultClient = ElasticEmail.ApiClient.instance;
// Configure API key authorization: apikey
let apikey = defaultClient.authentications['apikey'];
apikey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apikey.apiKeyPrefix = 'Token';
let apiInstance = new ElasticEmail.SegmentsApi();
let name = "My Segment 1"; // String | Name of your segment.
apiInstance.segmentsByNameDelete(name, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| name | String | Name of your segment. |
null (empty response body)
- Content-Type: Not defined
- Accept: Not defined
Segment segmentsByNameGet(name)
Load Segment
Returns details for the specified segment. Required Access Level: ViewContacts
import ElasticEmail from '@elasticemail/elasticemail-client';
let defaultClient = ElasticEmail.ApiClient.instance;
// Configure API key authorization: apikey
let apikey = defaultClient.authentications['apikey'];
apikey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apikey.apiKeyPrefix = 'Token';
let apiInstance = new ElasticEmail.SegmentsApi();
let name = "name_example"; // String | Name of the segment you want to load. Will load all contacts if the 'All Contacts' name has been provided
apiInstance.segmentsByNameGet(name, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| name | String | Name of the segment you want to load. Will load all contacts if the 'All Contacts' name has been provided |
- Content-Type: Not defined
- Accept: application/json
Segment segmentsByNamePut(name, segmentPayload)
Update Segment
Rename or change RULE for your segment. Required Access Level: ModifyContacts
import ElasticEmail from '@elasticemail/elasticemail-client';
let defaultClient = ElasticEmail.ApiClient.instance;
// Configure API key authorization: apikey
let apikey = defaultClient.authentications['apikey'];
apikey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apikey.apiKeyPrefix = 'Token';
let apiInstance = new ElasticEmail.SegmentsApi();
let name = "My Segment 1"; // String | Name of your segment.
let segmentPayload = new ElasticEmail.SegmentPayload(); // SegmentPayload |
apiInstance.segmentsByNamePut(name, segmentPayload, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| name | String | Name of your segment. | |
| segmentPayload | SegmentPayload |
- Content-Type: application/json
- Accept: application/json
[Segment] segmentsGet(opts)
Load Segments
Returns a list of all your available Segments. Required Access Level: ViewContacts
import ElasticEmail from '@elasticemail/elasticemail-client';
let defaultClient = ElasticEmail.ApiClient.instance;
// Configure API key authorization: apikey
let apikey = defaultClient.authentications['apikey'];
apikey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apikey.apiKeyPrefix = 'Token';
let apiInstance = new ElasticEmail.SegmentsApi();
let opts = {
'limit': 100, // Number | Maximum number of returned items.
'offset': 20 // Number | How many items should be returned ahead.
};
apiInstance.segmentsGet(opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| limit | Number | Maximum number of returned items. | [optional] |
| offset | Number | How many items should be returned ahead. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Segment segmentsPost(segmentPayload)
Add Segment
Add a new segment, based on specified RULE. Required Access Level: ModifyContacts
import ElasticEmail from '@elasticemail/elasticemail-client';
let defaultClient = ElasticEmail.ApiClient.instance;
// Configure API key authorization: apikey
let apikey = defaultClient.authentications['apikey'];
apikey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apikey.apiKeyPrefix = 'Token';
let apiInstance = new ElasticEmail.SegmentsApi();
let segmentPayload = new ElasticEmail.SegmentPayload(); // SegmentPayload |
apiInstance.segmentsPost(segmentPayload, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| segmentPayload | SegmentPayload |
- Content-Type: application/json
- Accept: application/json