HTTP Client¶
The HTTP client node establishes an client that can call an API to make a request to the HTTP server.
Node Type¶
External.
Input and Output Ability¶
This node has 1 entry point and 1 exit point. Both the input and the output can be any format.
The body is automatically output to msg while the header and attribute information is stored in the metadata, which can be queried by using ${metadata.key}
, where key corresponds to the key of the header/attribute.
Node Properties¶
Name
The name for this node.
Request
The request method this node uses to make a request to the server. Supports GET, POST, PUT, DELETE, Upload File, and Download File.
Upload File/Download File is a request method based on POST/GET. No size limit for Upload File, and the max file size for Download File is 100M.
URL
The URL of the HTTP server.
When selecting Upload File for Request, if the URL is from HTTP Server, you can use HTTP Server in another flow to check the upload finished. If the URL is from the server out of EnOS, you should check the server to make sure the file uploaded.
Request Body Type
When selecting POST, PUT, or DELETE for Request, you need to select Request Body Type. Supports Body and Form.
File Path
When selecting Download File for Request, you need to specify the path to download the file to, starting with a forward slash. For example, /fileName.txt
. To retrieve the file contents, you can use the File node in the flow.
Timeout
The request timeout of this node. The unit is in millisecond and the default value is 30,000. If this node does not receive any response from the server within this timeout period, this request will timeout. The minimum timeout available is 1,000 milliseconds.
Authentication Method
The method of how a request made by this node is authenticated. Possible values include the following.
Anonymous: Does not need any authentication.
Username/Password: Passes the username/password in the request for authentication.
Digest Authentication: Passes the digest of the username/password in the request for authentication.
Params
The parameters attached to the URL of the request in the form of “?key=value”.
Headers
The key-value pairs included in the header of the request.
Body
When selecting Upload File for Request, or selecting POST or PUT for Request and Body for Request Body Type, you can enter data here, which will be output to the output msg. While the data can be in any format, it is usually in JSON.
When selecting Upload File for Request, the file’s contents will be displayed in the body of the output msg if this field is blank.
Form
When selecting POST/PUT/DELETE for Request, and Form for Request Body Type, you can add key-value pairs of the form data.
Keep Cookie
Keeps the cookie information for session management.
Description
The description for this node.
Limitations¶
Max download file size: 100M
As the HTTP server is not managed by EnOS, connection problems could occur due to server downtime or other instances that are not within our control.
Samples¶
Input Sample¶
If an HTTP client node requesting weather information of a specific place has the following configurations:
Field |
Value |
---|---|
Name |
HTTP Client |
Request |
GET |
URL |
|
Timeout |
None |
Authentication |
Anonymous |
Params |
zip: 95050 |
Headers |
None |
Then it is equivalent to making an request as follows:
Output Sample¶
Given the configuration above, the sample output returning the requested weather information is as follows:
{
"MetaData":{
"CamelHttpResponseCode": "200",
"CamelHttpQuery": "",
"CamelHttpResponseText": "OK"
},
"Body":{
"coord":{
"lon":-121.95,
"lat":37.35
},
"weather":[
{
"id":721,
"main":"Haze",
"description":"haze",
"icon":"50n"
}
],
"base":"stations",
"main":{
"temp":59.88,
"feels_like":59.61,
"temp_min":59,
"temp_max":61,
"pressure":1015,
"humidity":77
},
"visibility":3219,
"wind":{
"speed":1.95,
"deg":310
},
"clouds":{
"all":90
},
"dt":1600071865,
"sys":{
"type":1,
"id":5845,
"country":"US",
"sunrise":1600091374,
"sunset":1600136217
},
"timezone":-25200,
"id":0,
"name":"Santa Clara",
"cod":200
}
}