Skip Navigation


Sabre Red 360 Software Development Kit provides a capability to call an external service via HTTP protocol.

Usage with TypeScript

The ExternalServiceConnector allows to call external services via HTTP in Web Module.

Acquiring ExternalServiceConnector

In order to obtain ExternalServiceConnector and use it, you need to import it:

import {ExternalServiceConnector} from 'sabre-ngv-app/app/services/impl/ExternalServiceConnector';

Then obtain the service inside your source as below:

const externalServiceConnector: ExternalServiceConnector = getService(ExternalServiceConnector);

Available methods

callService(url: string, method: string, body: string, headers: Object, credentials?: CredentialsOption): NgvPromise<Object>;

Type Parameters:

  • url - URL of the service to be called

  • method - HTTP method to be used (currently available: GET, POST, PUT, DELETE)

  • body - request body (use empty string if it is not needed)

  • headers - Object containing HTTP headers (use empty map ({}) if it is not needed)

  • credentials - indicates whether cookies should be sent or received from the other domain in the case of cross-origin requests.
    Optional, available values: 'include', 'same-origin' or 'omit', default value: 'include'. Applicable only in Sabre Red Web.


Call to the service is performed asynchronously and the result is returned as NgvPromise which returns a JSON string with the response.


Below you can find a sample call to a service using the POST method, sending 'Sample request body' and setting a 'Cookie' header with 'myCookie' value:

const externalServiceConnector = getService(ExternalServiceConnector);

    'Sample request body',
    { Cookie: 'myCookie' }

When the call is completed and response is received the function registered with .done is executed. It takes one argument which is a JSON string containing a response from the service.

private updateModel(data: Object) {
    const response = JSON.parse(data.toString()).responseBody;
    this.getModel().set('serviceResponse', { response: response.payload });