Implement Integration Namespaces
REST Services
REST Integration services are used to integrate the external API with the current solution. The external API could be integrated by adding the specification as an API dependency or not.
An example of the implementation of a REST service which is called
GetExternalCustomer and belongs to the integration namespace cus
will
follow.
// Make a HTTP request to an operation. The path and query pathParmamidentifier must the same types and name as they are defined in the API dependency specification.
const response = await this.apis.apiDependencyName.OperationId({pathParmamidentifier: “value1”});
// Check whether the call was successful and, if it is, give the name of the customer as output
if (response.status === 200) {
// Initialize the output entity
this.output = this.factory.entity.cus.RestServiceIdentifier_Output();
// Initialize the output property
this.output.property1 = response.body.property1;
Attention: Properties of type String with format Date must be
initialized like this:
strProperty = "2019-09-01"
.
Additionally, properties of type String with format Date-Time must be
initialized like this: strProperty = new
Date("2019-09-01").toISOString()
. Where the date structure is
strictly "<year>-<month>-<day>".