Rate this page:

How to communicate with external APIs

VoxEngine enables our cloud to exchange info with 3rd party services/APIs due to the Net namespace. Learn how to make and accept HTTP requests as well as sending emails in your JS cloud scenarios

Perform HTTP Requests

There are two methods that allow performing requests: httpRequest and httpRequestAsync.

The httpRequest method performs synchronous HTTP requests. Its second parameter is a callback function that can accept the HttpRequestResult object and process the object's properties.

synchronous request

synchronous request

The httpRequestAsync method performs asynchronous HTTP requests, i.e., the method returns a Promise which resolves with the HttpRequestResult object.

asynchronous request

asynchronous request

timeouts and default verb

By default, both methods use the GET verb to perform requests. TCP connect timeout is 6 seconds and total request timeout is 90 seconds.

Send Emails

Sometimes it's convenient or even necessary to send emails to an external service. To meet this need you can use either the sendMail or sendMailAsync methods. Both of them process the SendMailResult object after a successful call.

sync email

sync email

async email

async email