4.2.2.14. Rest Gateway In
This gateway in allows you to easily publish a REST api.
It has the following characteristics:
- It will respond synchronously to the REST api calls with the result of the processing of the message by the channels.
- It injects an xml message in that contains all the elements of the REST call (uri, parameters, expected output format, ...).
- It supports 'json', 'xml' and 'csv' as output format.
- It supports multi-credentials.
The specific settings are:
Here is an example of message In, that is generated by this gateway if you use the HTTP method POST.
<?xml version="1.0" encoding="UTF-8"?> <restRequest> <uri>/sws/shipmentStatus/BE.json</uri> <identifier>sws</identifier> <action>shipmentStatus</action> <method>GET</method> <format>json</format> <userName>bertrand</userName> <parameters> <param1>BE</param1> <myParam>myValue</youpie> </parameters> <POST>... Payload or body of your HTTP call ... </POST> </restRequest>
xml tags will match the HTTP method you use to perform the call. Those would be if you are using the GET method, etc...
Below is how to use the URL parameters for a REST API Server Gateway IN
For example we have created the REST API Server Gateway IN with the below parameters as a test values for explanation
1-The "Url identifier" as "testurl".
2-Regarding the "Allowed credentials" the "Username" as "usernametest" and the "Password" as "passwordtest".
3-For this test environment the "Url to call" is "http://ws.babelway.net/rest/testurl/message(?URL Params).(json|xml)"
To use the URL settings for a REST API Server Gateway IN, for example, this is the Url to call "http://ws.babelway.net/rest/testurl/message(?URL Params).(json|xml)"
You will replace the (?URL Params) with your URL params you want to use them.
Regarding the (json|xml) here you can determine the format of the data.
Note: If you want to get the input message name then you have to select one of the two below mentioned options. This is due to the fact that, when using the REST API Server Gateway IN there is no file.
- Option one: You will need to include the input file name somewhere in the API call in the body of the HTTP call.
- Option two: You will need to include the input file name somewhere in the URL parameters.
Now you can use the name that you have provided by selecting one of the two above mentioned options to create the output message file name.
Note:
- If there is a file name provided in the "Message In" or "Message Out" which contain ~ tilde character, All browser based on Chromium will replace the ~ tilde character by the _ underscore character when you try to download the file from the Babelway interface, For more details you can check this link https://bugs.chromium.org/p/chromium/issues/detail?id=479419
- You can check bunch of info like last success date, last message date …etc. by pressing on Run Info button.
- Our synchronous Gateways is not covering the FULL processing of the message but only until the generation of the MessageOUT.
- The maximum file size accepted by this gateway is 100 MB.