In Copilot Studio, you have the option to enhance a copilot’s functionalities by leveraging the HTTP request node to call external REST APIs. This proves beneficial when you require data retrieval from an external system or wish to perform data manipulation on that system.

Use the HTTP request node

1. Select Add node (+), open the Advanced sub menu, and then select Send HTTP request.

2. In the URL box, enter the URL for the API endpoint you want to call. Select the appropriate request Method from the dropdown. GET, POST, PATCH, PUT and DELETE methods are supported.

3. Under Headers and body on the node, click the Edit button. This will open the HTTP request properties pane. By default, no content is sent in the body of the HTTP request, but you specify content to be sent on the body.

4. On the node, choose the Response data type from the available options.

You have the option to supply a sample JSON response (often available in the API documentation) to generate a strongly typed Power FX variable. This enables you to utilize it across your authoring canvas with IntelliSense support in the Power FX editor. To accomplish this, select ‘From Sample Data,’ then click ‘Get schema from sample JSON.’ Paste your sample response into the editor provided and confirm your selection.

5. Save the response in a variable. Get the response from the REST API directly to copilot studio in that variable.

6. Test the copilot using trigger phrases.

You can do error handling and timeout if you need in some cases. To configure the error handling behavior.

  1. Under Headers and body on the node, click the Edit button. This will open the HTTP request properties pane.
  2. Choose your desired behavior from the Error handling dropdown.
  3. If you choose Continue on error, configure the Status code, and Error response body variables, either creating new variables or selecting existing variables from the picker.