Response Manager

The Response Manager is used to define the details of a response from the API back to the calling system.

Content Type

The Response Message Protocol can be set with the Content Type. The following formats can be used:

  • JSON
  • XML
  • plaintext
  • ISO Message

HTTP Status

See Status Codes for a list of standard HTTP status codes.


It can also be a variable e.g ${varHttpStatus} or GLU reserved word for HTTP status code GLU_STATUS_CODE to pass the last status code from third party, example below.



ResponseCode and ResponseMessage

Within the GLU.Engine, the responseCode and responseMessage generated by an Outbound Connector are internally mapped to SystemErrorCode and SystemErrorMessage in the Response Handler. This default mapping occurs regardless of whether the original Code and Message indicate an ‘Error’ scenario.

Note: In the API Response drop-down lists for the ‘Response Code’ and ‘Response Message’ it is possible to pick the SystemErrorCode and SystemErrorMessage to map the values to your Response payload.

Default Mapping:

  • responseCode: The code from the Outbound Connector’s response.
  • responseMessage: The message from the Outbound Connector’s response.
  • SystemErrorCode: Internally mapped to responseCode.
  • SystemErrorMessage: Internally mapped to responseMessage.

Pass Last Response Content Back

If this Checkbox is ticked the value in the template field will not be used. Instead the content of the last orchestrated connector will be passed back as the response to the API.

The Error Template, however can still be defined.

Save Response As

The ‘save response as’ checkbox in GLU.Engine provides a feature for storing the response returned from a 3rd-party service into a GLU object. This stored response can then be utilised within the same transaction for various purposes, such as sending the payload as part of a database (DB) call or using it as a parameter in subsequent actions. Both the outbound response from the 3rd party and the GLU.Engine response can be saved as objects. In the example below, responseBackToClient can be referred to with: ${responseBackToClient }

Key Points:

  1. Storage of Response:
    • The ‘save response as’ checkbox allows for storing the response as a GLU object.
  2. Usage Within the Transaction:
    • The stored response can be referenced within the same transaction for further processing.
  3. Potential Use Cases:
    • Common scenarios include using the stored response in database calls or passing it back as a parameter in subsequent actions.
  4. Parameter Naming:
    • Once a parameter name is defined for the stored response, it can be treated like any other parameter in the integration.

Example:

- Checkbox: 'Save Response As'
- Parameter Name: responseBackToClient
  • In this example, the response from the 3rd-party service is stored as an object with the parameter name ‘responseBackToClient’.
  • This stored response can then be referenced within the transaction using the notation: ${responseBackToClient}.



Template & Error Template

The structure of your API response is defined here.

Setting up response templates

You can setup the success template as is required as the response to the API. The template supports ES6 format.

For example, if you wanted to pass a parameter you could add ${<Parameter Name>} to your template and it would be replaced with the parameter value at runtime.


For both the error and successful templates, parameters can be specified as the response parameters.

Triggering a success or failure response

  • Successful template: The defined structure in ‘Template’, will be triggered for successful response messages.
  • Error template: The defined structure in ‘Error Template’ will be triggered when the API is deemed too have failed.


A successful response will be triggered when the value held within the ‘Response Code’ selected parameter in the dropdown is validated (and matches) the ‘Response Code To Validate’ value.



In the above example, when the response_code = 0, the success template will be triggered. If the response_code <> 0, the error template will be triggered.

When an error template is not defined, the GLU default error template will be used. See example below:

{
“error_message”: “Transaction Failed”,
“Message”: “There is No Response Template for FAILED Transactions”,
“GLU_TRX_ID”: “68dfa42b-cb4f-4b87-9c41-055b00789d57”,
“error_code”: “-99999”
}



Note: When using a STOP PROCESS handler in the configuration, an error response will be triggered. This excludes the STOP PROCESS successful response. This will populate the responseCode and responseMessage (or as configured in the parameters manager control panel) with the specified error code and error message as detailed in the stop process. Should an error template not be defined, the default engine error template will be triggered and the GLU ‘systemErrorCode’ and systemErrorMessage’ will be updated with the values specified in the STOP PROCESS handler.


Note: When using a STOP PROCESS handler in the configuration, it triggers an error response, specifically excluding the STOP PROCESS successful response. This action populates the responseCode and responseMessage (or as configured in the parameters manager control panel) with the designated error code and error message specified in the stop process. In the absence of a defined error template, the default engine error template is activated, updating the GLU ‘systemErrorCode’ and ‘systemErrorMessage’ with the values specified in the STOP PROCESS handler.

Including an array in the response template



To reference the array in your response payload, you can add an array like this: ${accounts[]} and the full array with the name will print.



It will display it in the response payload like this:

“accounts”: [
{ “accountID”: 0,
“amount”: 17209,
“balanceType”: “Savings”
},
{
“accountID”: 1,
“amount”: 0,
“balanceType”: “Money”
},
{
“accountID”: 23,
“amount”: 0,
“balanceType”: “Money”
},
{
“accountID”: 65,
“amount”: 0,
“balanceType”: “Money”
},
{
“accountID”: 1018,
“amount”: 0,
“balanceType”: “Money”
},
{
“accountID”: 1018,
“amount”: 0,
“balanceType”: “Money”
}
]



  
Was this article helpful?

Related Articles

Fill the form and we’ll contact you shortly

    I agree with

    cookies
    We uses cookies to make your experience on this website better. Learn more
    Accept cookies