Your first API request!
Now that we've successfully generated an API token, let's perform our first request against the Vanta API.
First, make sure you've completed the previous steps to setup a new OAuth application and that you have generated a client secret. If you haven't, follow the guide here first: Authentication
For this example, we are going to retrieve a list of our Integrations that we have connected to our Vanta instance. To perform this request, you will need to have already created an application using the "Manage Vanta" type. (The "Build Integrations" application type will not work for this example)
The integrations endpoint is: https://api.vanta.com/v1/integrations. We will pass in our Authorization
header and set the value to Bearer
followed by your API token. Here is an example cURL to get you started (make sure to replace your_token_here with your actual API token):
curl --location 'https://api.vanta.com/v1/integrations?pageSize=10' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer _your_token_here_'
const myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer _your_token_here_");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://api.vanta.com/v1/integrations?pageSize=100&pageCursor=<string>", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://api.vanta.com/v1/integrations?pageSize=100&pageCursor=<string>',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer _your_token_here_'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
import requests
url = "https://api.vanta.com/v1/integrations?pageSize=100&pageCursor=<string>"
payload = {}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer _your_token_here_'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
We should receive a successful response with the list of our integrations. It will look something like this:
{
"results": {
"pageInfo": {
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "b25lcGFzc3dvcmQ=",
"endCursor": "YmFtYm9vX2hy"
},
"data": [
{
"integrationId": "aws",
"displayName": "Amazon Web Services",
"resourceKinds": [
"AutoScalingGroup",
"CloudTrail",
"CloudWatchLogGroup",
"CloudWatchMetricAlarm",
"AwsCodeCommitRepo",
"AwsCredentialReport",
"DocumentDBCluster",
"DynamoDBTable",
"EC2Instance",
"ECRContainerRepository",
"AwsContainerVulnerabilityV2",
"ECSCluster",
"ECSService",
"ECSTask",
"EKSCluster",
"EKSNode",
"AwsFlowLog",
"AwsGroup",
"AwsGuardDutyDetector",
"AwsIAMIdentityCenterUserAccount",
"AwsAccount",
"AwsInspectorVulnerabilityV2",
"AwsLambdaFunction",
"ALB",
"AwsNetworkACL",
"AwsOrganizationSubAccount",
"AwsPasswordPolicy",
"RDSInstance",
"RedshiftCluster",
"AwsRole",
"AwsRouteTable",
"S3",
"AwsSecurityGroup",
"SQS",
"AwsSubnet",
"AwsVPC"
],
"connections": [
{
"connectionId": "<string>",
"isDisabled": false,
"connectionErrorMessage": null
},
{ // When multiple AWS Accounts integrated, additional connectionIds will be returned
"connectionId": "<string>",
"isDisabled": false,
"connectionErrorMessage": null
},
]
},
{
"integrationId": "asana",
"displayName": "Asana",
"resourceKinds": [
"AsanaAccount",
"AsanaTask"
],
"connections": [
{
"connectionId": "<string>",
"isDisabled": false,
"connectionErrorMessage": null
}
]
}
]
}
}
Updated 4 months ago