This article provides the steps necessary to write and run a simple Curl command
that queries the Red Canary API.
Estimated procedure time: 5 minutes.
Prerequisites
Before you run any code, make sure you have the following:
- Your API key. If you don't have your API key, or you need to reset an old key, see Reset your API key in the Red Canary Help Center.
- The latest recommended version of Curl. To download Curl, see https://curl.se/download.html.
Query the API
Open the command line, and run the following command. Be sure to replace <API key>
with your API key and <subdomain>
with the subdomain you want to query.
curl -X "GET" -H "X-Api-Key:<API key>" "https://<subdomain>.my.redcanary.co/openapi/v3/endpoints"
The command should print a JSON object containing the first page of endpoints associated with the subdomain.
Customize your request with parameters
You can use HTTP parameters to customize the results of your request. Visit the Red Canary API docs for a list of supported parameters for each API endpoint.
Example: Limit the number of endpoints returned
Limit the number of endpoints returned by Curl using the per_page
parameter.
Open the command line, run the following command. Be sure to replace <API key>
with your API key and <subdomain>
with the subdomain you want to query.
curl -X "GET" -H "X-Api-Key:<API key>" "https://<subdomain>.my.redcanary.co/openapi/v3/endpoints?per_page=1"
The command should print a JSON object containing exactly one endpoint.
Comments
0 comments
Please sign in to leave a comment.