HTTP request

更新时间:
复制 MD 格式

1. Component description

Note

Prerequisites: None

This component sends a request to a target address using the GET or POST method and retrieves the result. This action is equivalent to making a request with the Requests package.image.png

2. Input parameters

Note

For more information, see the help information for each input parameter in the component panel of the application flow editor.

3. Output parameters

Note

For more information, see the help information for each output parameter in the component panel of the application flow editor.

4. Component usage examples

4.1. Component configuration example

  1. For method, the valid values are GET (default) and POST.

  2. For URL, enter the request URL. This parameter is required. Include the protocol prefix, such as http:// or https://.

  3. For Headers, specify the HTTP request headers. Edit the expression to enter a dictionary, such as `{'Content-Type':'application/json','Authorization':'Bearer YOUR_ACCESS_TOKEN'}`.

  4. For Body, specify the HTTP request body. Edit the expression to enter a dictionary, such as `{'key1': 'value1','key2':'value2'}`.

  5. Keep the default values for the advanced options.

image.png

4.2. Example execution result

None

5. Example flow

Setup flow

  1. Use the HTTP Request component. Enter the input parameters and save the returned result in the v_http_response_1 dictionary.

  2. Use the Get Value by Key component. Select v_http_response_2, enter a key, such as content, and save the content in v_dict_value_1.

  3. Use the Record Log component. Select v_dict_value_1 and print it.

image.png

Execution result

After the flow runs successfully, the result is printed to the log panel as shown in the following figure.