Making API calls in Order Hub
Use the helper services that the Order Hub libraries provide to communicate with OMS, Inventory Visibility (IV), and IBM® Sterling™ Intelligent Promising (SIP) tenants. These helper services simplify API communication by automatically handling authentication and other connection requirements when you call REST APIs that use JSON.
Invoking OMS APIs
BucCommOmsRestAPIService using the following
function:invokeOMSRESTApi(api, data, params): Observable<any>- api
- The name of the API. For example,
getOrderList,getItemList, and so forth. - data
- The input JSON expected by the API.
- params
- Other parameters supported by Order Hub, such as caching parameters.
BucCommOmsRestAPIService.invokeOMSRESTApi('getItemPrice', payLoad, null);As a reference, the following tutorial invokes OMS APIs: Tutorial: Customizing the Schedule order action.
Invoking OMS services
BucCommOmsRestAPIService by using another
function:invokeOMSCustomService(api, data, params, customHeaders?: any): Observable<any>- api
- The name of the API. For example,
getOrderList,getItemList, and so on. - data
- The input JSON expected by the API.
- params
- Other parameters supported by Order Hub, such as caching parameters.
- customHeaders
- Any extra custom headers that need to be added to the request header.
BucCommOmsRestAPIService.invokeOMSCustomService('RequestForReassignOrderRelease', orderReleaseInput, null, customHeaders);Invoking IV and SIP APIs
To make REST calls to IV and SIP, you can check whether Order Hub already has helper services for the particular service. If not, you can create a new Angular service with a simple function to call the API.
public getNodeTypes(): Observable<any> {
const resourceDomain = 'promising';
const domain = BucCommBEHttpWrapperService.getPathPrefix(resourceDomain);
const options = BucCommBEHttpWrapperService.getRequestOptions(resourceDomain);
const tenantId = BucSvcAngularStaticAppInfoFacadeUtil.getPromisingTenantId();
let path = '/{tenantId}/v1/nodeTypes';
const queryParameters: any = {}
path = path.replace('{tenantId}', tenantId);
if (tenantId === undefined) {
return throwError(new Error('Missing required parameter: tenantId'));
}
const url = domain + path;
const p: HttpParams = RestServicesHelper.getSupplyDemandParameters(queryParameters);
const obsToReturn$ = this.http.get(url, resourceDomain, p, options);
return obsToReturn$;
}- The Order Hub libraries can set up the proper domain and authentication headers
for making http requests to the respective SIP micro services by using the resource
domain.Accepted resource domain values are:
- cas
- Gets the tenant authentication headers for communicating with SIP carrier micro services.
- catalog
- Gets the tenant authentication headers for communicating with SIP catalog micro services.
- configuration
- Gets the tenant authentication headers for communicating with SIP configuration micro services.
- inventory
- Gets the tenant authentication headers for communicating with IV micro services.
- inventory_buc
- Gets the tenant authentication headers for communicating with IV micro services that are intended for specific Order Hub screens.
- promising
- Gets the tenant authentication headers for communicating with SIP promising micro services.
- Set the path to be the relative REST API path of the micro service that you are trying to invoke.
The rest of the function from the example can be left as-is.
As a reference, the following tutorial invokes IV and SIP APIs: Tutorial: Customizing the Inventory search results page.