Breadcrumb
SrwAsyncApi
Sabre Red 360 Developer Toolkit provides a capability to execute several services from a Red App web module.
Acquiring SrwAsyncApi
In order to obtain SrwAsyncApi and use you need to import it, e.g.
import {SrwAsyncApi} from "sabre-ngv-app/app/services/impl/SrwAsyncApi";
Then inside your source obtain the service as follows:
const srwApi = getService(SrwAsyncApi);
Available methods
There are several methods available in SrwAsyncApi, all of which are asynchronous, below you can find detailed list of them.
sws |
---|
Type Parameteres: |
swsWithLock |
---|
Type Parameteres: |
lock |
---|
Type Parameteres: |
lockWithTimeout |
---|
Type Parameteres: |
tryLock |
---|
Type Parameteres: |
unlock |
---|
Type Parameteres: |
showInEmu |
---|
Type Parameteres: |
executeInEmu |
---|
Type Parameteres: |
rest2Sg |
---|
Type Parameters: |
rest2SgWithLock |
---|
Type Parameters: |
rest2SgWithHeaders |
---|
Type Parameters: |
rest2SgWithHeadersAndLock |
---|
Type Parameters: |
Authorization
In order to be able to use specific services through SrwApi, your Red App needs to have authorization for those services in it’s redapp.xml file.
SWS:
<Authorization name="com.sabre.edge.cf.sws.SWS" threshold="[threshold]" metric="[metric]"/>
Locking/Unlocking:
<Authorization name="com.sabre.edge.cf.host.Locking" threshold="[threshold]" metric="[metric]" />
ShowInEmu:
<Authorization name="com.sabre.edge.cf.emu.ShowInEmulator" threshold="[threshold]" metric="[metric]" />
ExecuteInEmu:
<Authorization name="com.sabre.edge.cf.emu.ExecuteInEmulator" threshold="[threshold]" metric="[metric]" />
Rest2SG:
To be able to connect to a Rest endpoint, e.g.
/v4/lists/utilities/geocode/locations and /v1/lists/utilities/aircraft/equipment
You need to add authorization to redapp.xml
<CFBundle> <RedApp id="rest-comm-sabre-sample"> <Authorization name="com.sabre.edge.cf.rest2sg.Rest2Sg"> <Action name="/v4/lists/utilities/geocode/locations" threshold="1" /> </Authorization> <Authorization name="com.sabre.edge.cf.rest2sg.Rest2Sg"> <Action name="/v1/lists/utilities/aircraft/equipment" threshold="1" /> </Authorization> </RedApp> </CFBundle>
otherwise there will be an AUTH error response from 2SG.