Anomaly Detection End Point
Summary
The Anomaly Detection API end point can be used to retrieve spending anomalies and create anomaly subscriptions as outlined in Anomaly Detection.
-
This end point does not support filtering and/or sorting.
End Point Particulars
end point: /anomalies for listing your organization's spending anomalies.
end point: /anomalies/subscriptions for all RESTful CRUD interactions related to anomaly subscriptions (receive anomaly alerts via email). See below.
The Anomalies Object
date (string) - Date of the anomaly, e.g., "2018-02-14"
type (string) - One-day or seven-day trend.
enhancedServiceName (string) - e.g., AWS EC2
usageFamily (string) - e.g., Data Transfer
unblendedCost (number) - Total cost for the day
unusualSpend (number) - The unusual portion of the spend for the day.
vendorAccountName (string) - Name associated with the account where the anomaly occurred
tags (array) - list of tag objects associated with the anomaly. Each object contains tag, tagName and vendorTagValue
Example Request - Retrieve List of Anomalies
Quite simply perform a GET request at the /anomalies end point, specifying a startDate and endDate. You may also optionally supply a viewId to restrict the returned anomalies to a particular view.
curl "https://api.cloudability.com/v3/anomalies?endDate=2018-02-22&startDate=2018-02-15"\\
-u ‘[auth_token]:’
{
"result": [
{
"date": "2018-02-17",
"type": "1-day",
"enhancedServiceName": "AWS EBS",
"usageFamily": "Storage",
"unblendedCost": "114.27826999999999",
"unusualSpend": "47.78951077214518",
"vendorAccountName": "AWS Production",
"tags": [
{
"tag": "tag5",
"tagName": "team",
"vendorTagValue": "PartyPeanut"
},
{
"tag": "tag7",
"tagName": "environment",
"vendorTagValue": "Production"
},
{
"tag": "tag9",
"tagName": "application",
"vendorTagValue": "TerreBelle"
}
]
}
]
}
{
"result": [
{
"date": "2018-02-17",
"type": "1-day",
"enhancedServiceName": "AWS EBS",
"usageFamily": "Storage",
"unblendedCost": "114.27826999999999",
"unusualSpend": "47.78951077214518",
"vendorAccountName": "AWS Production",
"tags": [
{
"tag": "tag5",
"tagName": "team",
"vendorTagValue": "PartyPeanut"
},
{
"tag": "tag7",
"tagName": "environment",
"vendorTagValue": "Production"
},
{
"tag": "tag9",
"tagName": "application",
"vendorTagValue": "TerreBelle"
}
]
}
]
}
Subscriptions Object
SubscriptionId (string) - UUID for the subscription
viewId (string) - Optional
unusualSpendThreshold (int) - How much unusual spending is required to trigger an alert
Example Subscriptions Object {
\t"result": {
\t\t"subscriptionId": "42ba1b73-72db-64bf-7ca6-709c760c09cb",
\t\t"viewId": "0",
\t\t"unusualSpendThreshold": 100
}
}
Example RequestsCreate a Subscription
curl -X POST https://api.cloudability.com/v3/anomalies/subscriptions \\
-H 'Content-Type: application/json' \\
-u ‘[auth_token]:’ \\
-d @- << EOF
{
"unusualSpendThreshold": 100,
"viewId": "11235"
}
EOF
A successful operation will result in the object being created and returned to the client.
Retrieve a Subscription
curl https://api.cloudability.com/v3/anomalies/subscriptions/42ba1b73-72db-64bf-7ca6-709c760c09cb \\
-u ‘[auth_token]:’
Update a Subscription
curl -X PUT https://api.cloudability.com/v3/anomalies/subscriptions/bc8cf34d-fa58-4bab-6800-3cf067edba8d \\
-H 'Content-Type: application/json' \\
-u ‘[auth_token]:’ \\
-d @- << EOF
{
"unusualSpendThreshold": 25
}
EOF
will return a modified Subscription Object.Delete a Subscription
curl -X DELETE https://api.cloudability.com/v3/anomalies/subscriptions/bc8cf34d-fa58-4bab-6800-3cf067edba8d \\
-u ‘[auth_token]:’
and if all goes well, you'll receive an ever so helpful confirmation.
{
\t"result": {
\t\t"message": "Successfully deleted",
\t\t"subscriptionID": "bc8cf34d-fa58-4bab-6800-3cf067edba8d"
\t}
}
List All
Subscriptions curl https://api.cloudability.com/v3/anomalies/subscriptions \\
-u ‘[auth_token]:’
will return any existing SubscriptionObjects. Note that subscriptions without a defined View will return a viewId of "0":
{
"result": [
{
"subscriptionId": "42ba1b73-72db-64bf-7ca6-709c760c09cb",
"viewId": "0",
"unusualSpendThreshold": 10
},
{
"subscriptionId": "78af1c06-f804-3258-722d-35a864df1f34",
"viewId": "8675",
"unusualSpendThreshold": 5
},
{
"subscriptionId": "7de42e2a-144d-n65d-55c2-cd048f7b43cb",
"viewId": "309",
"unusualSpendThreshold": 5
}
]
}