The HttpClientActor
is a Coral Actor that can perform POST, GET, PUT, and DELETE HTTP requests on a specified URL.
The HttpClientActor has "type": "httpclient"
. The params
value is a JSON object with the following fields:
field | type | required | description |
---|---|---|---|
mode |
string | yes | Either static or dynamic . |
field |
string | no | When mode is set to dynamic , the field to get the URL from. |
url |
string | yes | The URL to connect to. |
method |
string | yes | The HTTP method (verb) to use. |
headers |
JSON | no | Additional headers to send for the request. |
An example of a static HTTPClient is given below:
In this case, the actor will post the JSON it receives through its trigger to http://www.google.com.
An example of a dynamic HTPTClient is given below:
When the actor now receives a JSON object with a field “url” in it, it will post the received JSON to that URL.
The HttpClientActor
is triggered by a JSON object. The HttpClientActor
will perform the specified HTTP on the URL obtained as described above. The payload is the received trigger JSON object. Currently the client supports the following HTTP methods:
The HttpClientActor
emits a json with the status, header and body of the response of the http method that was triggered. The header field is an JSON object with as fields the different header fields and as values the header values.
The HttpClientActor
does not keep state.
The HttpClientActor
does not collect state from other actors.
The HttpClientActor
does not define a timer function.