Can the Endpoints API return more than a maximum of 20 results?
search cancel

Can the Endpoints API return more than a maximum of 20 results?

book

Article ID: 285929

calendar_today

Updated On:

Products

Carbon Black Cloud Endpoint Standard (formerly Cb Defense) Carbon Black Cloud Enterprise EDR

Issue/Introduction

The following code block is only returning 20 endpoints, though 1000's qualify:

end_date=$(date -d ‘-2 week’ ‘+%Y-%m-%dT%H:%M:%S.000Z’)
date_range=‘{ “criteria”: { “last_contact_time”: { “start”: “2017-08-27T00:00:00.000Z”, “end”: “‘$end_date’” } } }'

curl -H X-Auth-Token:$token -H “Content-Type: application/json” -s -k -X POST -d “$date_range” “$url/appservices/v6/orgs/$orgkey/devices/_search” 

Environment

  • Carbon Black Cloud API: v6 Devices API

Resolution

20 sensors is the default maximum. To override the default, add the "rows" qualifier such as  ->   "rows": 10000 
For example using the above code:
end_date=$(date -d ‘-2 week’ ‘+%Y-%m-%dT%H:%M:%S.000Z’)
date_range='{ "criteria": { "last_contact_time": { "start": "2017-08-27T00:00:00.000Z", "end": "'$end_date'" }, "rows": 10000  }'

curl -H X-Auth-Token:$token -H “Content-Type: application/json” -s -k -X POST -d “$date_range” “$url/appservices/v6/orgs/$orgkey/devices/_search”

Additional Information