Skip to content

ElasticEmail - JavaScript client for Elastic Email REST API

Notifications You must be signed in to change notification settings

ElasticEmail/elasticemail-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@elasticemail/elasticemail-client

ElasticEmail - JavaScript client for @elasticemail/elasticemail-client This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach.

Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used.

The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request.

To start using this API, you will need your Access Token (available here). Remember to keep it safe. Required access levels are listed in the given request’s description.

Downloadable library clients can be found in our Github repository here This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 4.0.0
  • Package version: 4.0.25
  • Generator version: 7.5.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install @elasticemail/elasticemail-client --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your @elasticemail/elasticemail-client from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/elasticemail/elasticemail-js then install it via:

    npm install elasticemail/elasticemail-js --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var ElasticEmail = require('@elasticemail/elasticemail-client');

var defaultClient = ElasticEmail.ApiClient.instance;
// Configure API key authorization: apikey
var 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['X-ElasticEmail-ApiKey'] = "Token"

var api = new ElasticEmail.CampaignsApi()
var name = "name_example"; // {String} Name of Campaign to delete
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.campaignsByNameDelete(name, callback);

Examples

Function
addCampaign readme
addContacts readme
addList readme
addTemplate readme
deleteCampaign readme
deleteContact readme
deleteList readme
deleteTemplate readme
exportContacts readme
loadCampaign readme
loadCampaignsStats readme
loadChannelsStats readme
loadList readme
loadStatistics readme
loadTemplate readme
sendBulkEmails readme
sendTransactionalEmails readme
updateCampaign readme
uploadContacts readme

Documentation for API Endpoints

All URIs are relative to https://api.elasticemail.com/v4

Class Method HTTP request Description
ElasticEmail.CampaignsApi campaignsByNameDelete DELETE /campaigns/{name} Delete Campaign
ElasticEmail.CampaignsApi campaignsByNameGet GET /campaigns/{name} Load Campaign
ElasticEmail.CampaignsApi campaignsByNamePausePut PUT /campaigns/{name}/pause Pause Campaign
ElasticEmail.CampaignsApi campaignsByNamePut PUT /campaigns/{name} Update Campaign
ElasticEmail.CampaignsApi campaignsGet GET /campaigns Load Campaigns
ElasticEmail.CampaignsApi campaignsPost POST /campaigns Add Campaign
ElasticEmail.ContactsApi contactsByEmailDelete DELETE /contacts/{email} Delete Contact
ElasticEmail.ContactsApi contactsByEmailGet GET /contacts/{email} Load Contact
ElasticEmail.ContactsApi contactsByEmailPut PUT /contacts/{email} Update Contact
ElasticEmail.ContactsApi contactsDeletePost POST /contacts/delete Delete Contacts Bulk
ElasticEmail.ContactsApi contactsExportByIdStatusGet GET /contacts/export/{id}/status Check Export Status
ElasticEmail.ContactsApi contactsExportPost POST /contacts/export Export Contacts
ElasticEmail.ContactsApi contactsGet GET /contacts Load Contacts
ElasticEmail.ContactsApi contactsImportPost POST /contacts/import Upload Contacts
ElasticEmail.ContactsApi contactsPost POST /contacts Add Contact
ElasticEmail.DomainsApi domainsByDomainDelete DELETE /domains/{domain} Delete Domain
ElasticEmail.DomainsApi domainsByDomainGet GET /domains/{domain} Load Domain
ElasticEmail.DomainsApi domainsByDomainPut PUT /domains/{domain} Update Domain
ElasticEmail.DomainsApi domainsByDomainRestrictedGet GET /domains/{domain}/restricted Check for domain restriction
ElasticEmail.DomainsApi domainsByDomainVerificationPut PUT /domains/{domain}/verification Verify Domain
ElasticEmail.DomainsApi domainsByEmailDefaultPatch PATCH /domains/{email}/default Set Default
ElasticEmail.DomainsApi domainsGet GET /domains Load Domains
ElasticEmail.DomainsApi domainsPost POST /domains Add Domain
ElasticEmail.EmailsApi emailsByMsgidViewGet GET /emails/{msgid}/view View Email
ElasticEmail.EmailsApi emailsByTransactionidStatusGet GET /emails/{transactionid}/status Get Status
ElasticEmail.EmailsApi emailsMergefilePost POST /emails/mergefile Send Bulk Emails CSV
ElasticEmail.EmailsApi emailsPost POST /emails Send Bulk Emails
ElasticEmail.EmailsApi emailsTransactionalPost POST /emails/transactional Send Transactional Email
ElasticEmail.EventsApi eventsByTransactionidGet GET /events/{transactionid} Load Email Events
ElasticEmail.EventsApi eventsChannelsByNameExportPost POST /events/channels/{name}/export Export Channel Events
ElasticEmail.EventsApi eventsChannelsByNameGet GET /events/channels/{name} Load Channel Events
ElasticEmail.EventsApi eventsChannelsExportByIdStatusGet GET /events/channels/export/{id}/status Check Channel Export Status
ElasticEmail.EventsApi eventsExportByIdStatusGet GET /events/export/{id}/status Check Export Status
ElasticEmail.EventsApi eventsExportPost POST /events/export Export Events
ElasticEmail.EventsApi eventsGet GET /events Load Events
ElasticEmail.FilesApi filesByNameDelete DELETE /files/{name} Delete File
ElasticEmail.FilesApi filesByNameGet GET /files/{name} Download File
ElasticEmail.FilesApi filesByNameInfoGet GET /files/{name}/info Load File Details
ElasticEmail.FilesApi filesGet GET /files List Files
ElasticEmail.FilesApi filesPost POST /files Upload File
ElasticEmail.InboundRouteApi inboundrouteByIdDelete DELETE /inboundroute/{id} Delete Route
ElasticEmail.InboundRouteApi inboundrouteByIdGet GET /inboundroute/{id} Get Route
ElasticEmail.InboundRouteApi inboundrouteByIdPut PUT /inboundroute/{id} Update Route
ElasticEmail.InboundRouteApi inboundrouteGet GET /inboundroute Get Routes
ElasticEmail.InboundRouteApi inboundrouteOrderPut PUT /inboundroute/order Update Sorting
ElasticEmail.InboundRouteApi inboundroutePost POST /inboundroute Create Route
ElasticEmail.ListsApi listsByListnameContactsGet GET /lists/{listname}/contacts Load Contacts in List
ElasticEmail.ListsApi listsByNameContactsPost POST /lists/{name}/contacts Add Contacts to List
ElasticEmail.ListsApi listsByNameContactsRemovePost POST /lists/{name}/contacts/remove Remove Contacts from List
ElasticEmail.ListsApi listsByNameDelete DELETE /lists/{name} Delete List
ElasticEmail.ListsApi listsByNameGet GET /lists/{name} Load List
ElasticEmail.ListsApi listsByNamePut PUT /lists/{name} Update List
ElasticEmail.ListsApi listsGet GET /lists Load Lists
ElasticEmail.ListsApi listsPost POST /lists Add List
ElasticEmail.SecurityApi securityApikeysByNameDelete DELETE /security/apikeys/{name} Delete ApiKey
ElasticEmail.SecurityApi securityApikeysByNameGet GET /security/apikeys/{name} Load ApiKey
ElasticEmail.SecurityApi securityApikeysByNamePut PUT /security/apikeys/{name} Update ApiKey
ElasticEmail.SecurityApi securityApikeysGet GET /security/apikeys List ApiKeys
ElasticEmail.SecurityApi securityApikeysPost POST /security/apikeys Add ApiKey
ElasticEmail.SecurityApi securitySmtpByNameDelete DELETE /security/smtp/{name} Delete SMTP Credential
ElasticEmail.SecurityApi securitySmtpByNameGet GET /security/smtp/{name} Load SMTP Credential
ElasticEmail.SecurityApi securitySmtpByNamePut PUT /security/smtp/{name} Update SMTP Credential
ElasticEmail.SecurityApi securitySmtpGet GET /security/smtp List SMTP Credentials
ElasticEmail.SecurityApi securitySmtpPost POST /security/smtp Add SMTP Credential
ElasticEmail.SegmentsApi segmentsByNameDelete DELETE /segments/{name} Delete Segment
ElasticEmail.SegmentsApi segmentsByNameGet GET /segments/{name} Load Segment
ElasticEmail.SegmentsApi segmentsByNamePut PUT /segments/{name} Update Segment
ElasticEmail.SegmentsApi segmentsGet GET /segments Load Segments
ElasticEmail.SegmentsApi segmentsPost POST /segments Add Segment
ElasticEmail.StatisticsApi statisticsCampaignsByNameGet GET /statistics/campaigns/{name} Load Campaign Stats
ElasticEmail.StatisticsApi statisticsCampaignsGet GET /statistics/campaigns Load Campaigns Stats
ElasticEmail.StatisticsApi statisticsChannelsByNameGet GET /statistics/channels/{name} Load Channel Stats
ElasticEmail.StatisticsApi statisticsChannelsGet GET /statistics/channels Load Channels Stats
ElasticEmail.StatisticsApi statisticsGet GET /statistics Load Statistics
ElasticEmail.SubAccountsApi subaccountsByEmailCreditsPatch PATCH /subaccounts/{email}/credits Add, Subtract Email Credits
ElasticEmail.SubAccountsApi subaccountsByEmailDelete DELETE /subaccounts/{email} Delete SubAccount
ElasticEmail.SubAccountsApi subaccountsByEmailGet GET /subaccounts/{email} Load SubAccount
ElasticEmail.SubAccountsApi subaccountsByEmailSettingsEmailPut PUT /subaccounts/{email}/settings/email Update SubAccount Email Settings
ElasticEmail.SubAccountsApi subaccountsGet GET /subaccounts Load SubAccounts
ElasticEmail.SubAccountsApi subaccountsPost POST /subaccounts Add SubAccount
ElasticEmail.SuppressionsApi suppressionsBouncesGet GET /suppressions/bounces Get Bounce List
ElasticEmail.SuppressionsApi suppressionsBouncesImportPost POST /suppressions/bounces/import Add Bounces Async
ElasticEmail.SuppressionsApi suppressionsBouncesPost POST /suppressions/bounces Add Bounces
ElasticEmail.SuppressionsApi suppressionsByEmailDelete DELETE /suppressions/{email} Delete Suppression
ElasticEmail.SuppressionsApi suppressionsByEmailGet GET /suppressions/{email} Get Suppression
ElasticEmail.SuppressionsApi suppressionsComplaintsGet GET /suppressions/complaints Get Complaints List
ElasticEmail.SuppressionsApi suppressionsComplaintsImportPost POST /suppressions/complaints/import Add Complaints Async
ElasticEmail.SuppressionsApi suppressionsComplaintsPost POST /suppressions/complaints Add Complaints
ElasticEmail.SuppressionsApi suppressionsGet GET /suppressions Get Suppressions
ElasticEmail.SuppressionsApi suppressionsUnsubscribesGet GET /suppressions/unsubscribes Get Unsubscribes List
ElasticEmail.SuppressionsApi suppressionsUnsubscribesImportPost POST /suppressions/unsubscribes/import Add Unsubscribes Async
ElasticEmail.SuppressionsApi suppressionsUnsubscribesPost POST /suppressions/unsubscribes Add Unsubscribes
ElasticEmail.TemplatesApi templatesByNameDelete DELETE /templates/{name} Delete Template
ElasticEmail.TemplatesApi templatesByNameGet GET /templates/{name} Load Template
ElasticEmail.TemplatesApi templatesByNamePut PUT /templates/{name} Update Template
ElasticEmail.TemplatesApi templatesGet GET /templates Load Templates
ElasticEmail.TemplatesApi templatesPost POST /templates Add Template
ElasticEmail.VerificationsApi verificationsByEmailDelete DELETE /verifications/{email} Delete Email Verification Result
ElasticEmail.VerificationsApi verificationsByEmailGet GET /verifications/{email} Get Email Verification Result
ElasticEmail.VerificationsApi verificationsByEmailPost POST /verifications/{email} Verify Email
ElasticEmail.VerificationsApi verificationsFilesByIdDelete DELETE /verifications/files/{id} Delete File Verification Result
ElasticEmail.VerificationsApi verificationsFilesByIdResultDownloadGet GET /verifications/files/{id}/result/download Download File Verification Result
ElasticEmail.VerificationsApi verificationsFilesByIdResultGet GET /verifications/files/{id}/result Get Detailed File Verification Result
ElasticEmail.VerificationsApi verificationsFilesByIdVerificationPost POST /verifications/files/{id}/verification Start verification
ElasticEmail.VerificationsApi verificationsFilesPost POST /verifications/files Upload File with Emails
ElasticEmail.VerificationsApi verificationsFilesResultGet GET /verifications/files/result Get Files Verification Results
ElasticEmail.VerificationsApi verificationsGet GET /verifications Get Emails Verification Results

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

apikey

  • Type: API key
  • API key parameter name: X-ElasticEmail-ApiKey
  • Location: HTTP header