helpful-purple
helpful-purple16mo ago

test POST request API block

How to test a POST request in an API block ?
4 Replies
Tico | Voiceflow Assistant
To test a POST request in an API block on Voiceflow, follow these steps: 1. Select the POST Option: - In the API block, choose the POST request type. 2. Add Headers: - Click on the + next to the Headers section. - Add necessary headers such as Authorization if required by your API. For example:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

3. Configure the Endpoint: - Enter the endpoint URL where the POST request will be sent. This URL is provided by the API documentation. 4. Set Up the Body: - Click on the + next to the Body section and select Raw. - Paste the JSON body content required by the API. For example:
{
"name": "New Task",
"due_date": "2023-10-01"
}

{
"name": "New Task",
"due_date": "2023-10-01"
}

5. Capture Response: - If you need to capture the response, use the Capture Response section to map the response data to variables. For example:
response.id -> {taskId}
response.name -> {taskName}

response.id -> {taskId}
response.name -> {taskName}

6. Send Request: - Click on Send Request to test the API call. If the request is successful, you will see a Success message. 7. Troubleshooting: - If the request fails, double-check the API documentation for the correct endpoint, headers, and body format. - Use tools like Postman or Insomnia to validate the request outside of Voiceflow. By following these steps, you can effectively test a POST request in an API block on Voiceflow.
W. Williams (SFT)
Just click the Send Request button
helpful-purple
helpful-purpleOP16mo ago
in the API Block, in the Body tab we can select "form body" field. - what data should we enter ? - same question for the field "variable" ?
W. Williams (SFT)
I responded to this already. You need to provide us with a bit more info about the API you are trying to post to.

Did you find this page helpful?