API query on AWS volumes that are not in use
search cancel

API query on AWS volumes that are not in use

book

Article ID: 283447

calendar_today

Updated On:

Products

CloudHealth

Issue/Introduction

In our Asset API, the "In Use" attribute is not searchable and cannot be used. 

Resolution

Rather than using the query:

curl -v -H "Accept: application/json" "https://chapi.cloudhealthtech.com/api/search?name=AwsVolume&api_key=$APIKEY&api_version=2&page=1&query=in_use=0"

Instead you will want to use something similar to:

curl -v -H "Accept: application/json" "https://chapi.cloudhealthtech.com/api/search?name=AwsVolume&api_key=$APIKEY&api_version=2&page=1&query=state<>'in-use'+and+state<>'deleted'"

In the above example, <> is being used as a "does not equal" operator and "state" is equivalent to the "Status" smart filter in asset reporting which can be used with any of the options present there.