http

Send a request to a HTTP endpoint.

Description

  • Send a request to a HTTP endpoint.

Parameters

Parameter

Type

Required

Default

Comment

body

str

No

Request body. This parameter is used for PUT, POST, and PATCH method.

format

str

No

text

Data format to decode a response body. It can be either text or json.

method

str

No

get

HTTP method. Following methods are available: get, put, post, patch, and delete.

out_bb

bool

No

False

If this parameter is set to True, the data is stored in the blackboard rather than in the flowdata.

By default, the key in the blackboard is set to the node name. To customize the key, specify the out_field parameter.

out_field

str

No

None

The key for the data in the blackboard. If out_bb is set to False, this parameter is ignored.

timeout

float

No

10

Timeout in second.

url

str

Yes

-

URL.

Examples

# Get with json format
# Output: {"http": {"data": {"foo": "bar"}, "status": 200}}
- http:
    name: "http"
    url: "http://example.com/api/data"
    format: "json"

# Get with text format
# Output: {"http": {"data": '{"foo": "bar"}', "status": 200}}
- http:
    name: "http"
    url: "http://example.com/api/data"
    format: "json"

# Timeout Error
# Output: {"http": '{"error": "TimeoutError"}'}
- http:
    name: "http"
    url: "http://example.com/api/data"
    format: "json"
    timeout: "1"