Overview
The Representational State Transfer (REST) Handler provides a simple and programmatic way to interact with remote HTTP services and returns the response result to the client.
Currently the handler supports:
1. REST actions - DELETE, GET, POST, PUT
2. Authentication - None, Basic, NTLM (Windows)
At a high level, the flow of actions is:
1. Initialize - It will read the handler configuration from the Action Config values in the Synapse plan.
2. Execute - It will parse the incoming Action Parameter data, validate and interact with designated HTTP services accordingly. Result plan is returned upon completion advising the operation success or failure.
3. Progress - It will advertise the run-time status.
Plan Details
Config
None.
Sample
None
Parameters
The Parameter section specifies what a client should send in during run-time.
Sample
| Element | Type/Value | Required | Description |
|---|---|---|---|
| Authentication | String | Yes | Valid values are "none", "basic", "ntlm". "oauth1" and "oauth2" are to be added later. |
| Username | String | No | Username is not required for authentication "none". But it is required for the others. |
| Password | String | No | Password is not required for authentication "none". But it is required for the others. |
| Domain | String | No | It is only required for authentication "ntlm". |
| Url | string | Yes | Destination url. |
| Body | string | No | Request body if any to be sent to remote site. |
| Method | string | Yes | Valid values are "delete", "get", "post" and "put". |
| ContentType | string | No | For "post" or "put" method, it is mandatory. |
Sample Execution
Sample 1 - Anonymous GET
This test script can be modified to simulate a test request sent from client to Synapse to invoke the handler.
Handler response, contained in the "ExitData" field and captured in the $result PowerShell variable may look like this in "json" format.
If the value of "ExitCode" is 0, it means the operation is successful. The value of -1 indicates the operation fails. "Message" will provide brief summary of the success or the reason of failure.
Sample 2 - Anonymous POST
This test script can be modified to simulate a test request sent from client to Synapse to invoke the handler.
Handler response, contained in the "ExitData" field and captured in the $result PowerShell variable may look like this in "json" format.
If the value of "ExitCode" is 0, it means the operation is successful. The value of -1 indicates the operation fails. "Message" will provide brief summary of the success or the reason of failure.
Sample 3 - Anonymous PUT
This test script can be modified to simulate a test request sent from client to Synapse to invoke the handler.
Handler response, contained in the "ExitData" field and captured in the $result PowerShell variable may look like this in "json" format.
If the value of "ExitCode" is 0, it means the operation is successful. The value of -1 indicates the operation fails. "Message" will provide brief summary of the success or the reason of failure.
Sample 4 - Anonymous DELETE
This test script can be modified to simulate a test request sent from client to Synapse to invoke the handler.
Handler response, contained in the "ExitData" field and captured in the $result PowerShell variable may look like this in "json" format.
If the value of "ExitCode" is 0, it means the operation is successful. The value of -1 indicates the operation fails. "Message" will provide brief summary of the success or the reason of failure.
Sample 5 - GET with Basic Authentication
This test script can be modified to simulate a test request sent from client to Synapse to invoke the handler.
Handler response, contained in the "ExitData" field and captured in the $result PowerShell variable may look like this in "json" format.
If the value of "ExitCode" is 0, it means the operation is successful. The value of -1 indicates the operation fails. "Message" will provide brief summary of the success or the reason of failure.
Sample 6 - GET with NTLM (Windows) Authentication
This test script can be modified to simulate a test request sent from client to Synapse to invoke the handler.
Handler response, contained in the "ExitData" field and captured in the $result PowerShell variable may look like this in "json" format.
If the value of "ExitCode" is 0, it means the operation is successful. The value of -1 indicates the operation fails. "Message" will provide brief summary of the success or the reason of failure.