HTTP Request
Category: Web Service
This activity allows you to make HTTP requests to a target and is highly customizable. You can select what HTTP method to use, define your own headers, provide a payload to send, and more. After the activity completes, it’ll provide you information about the request such as the HTTP status code and the response received.
Best Practices
- Check the
Continue on HTTP Error Status Code
box and use aCondition Block
to check the HTTP status code. This requires understanding the expected response of the API call you’re making. For example, you may want to have oneCondition Branch
check that the status code is 200 (indicating a success) and have anotherCondition Branch
that checks that the status code is not equal to 200 (meaning something may have gone wrong). Note that there are other 2xx status codes indicating success, so this logic will vary depending on the API.
Hints
- If sending a JSON payload in a
POST
orPUT
, it’s sometimes best to build the JSON payload in Python as opposed to directly in theRequest Body
activity input. Building JSON in the activity’s input does not handle escaping, so nested quotes or other complex data can break the JSON syntax.
Sample Workflows
The following sample workflows are available in our repository’s workflows folder to help you get familiar with this activity. These can be imported using the instructions here or you can view the workflow in GitHub by clicking on it.