- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
10-28-2019 12:15 AM - last edited on 09-02-2020 11:12 AM by CHopson
Hi,
Am trying to fetch alerts based upon an absolute timerange to ensure I don't continuously run into timeouts with my queries (want to get all open alerts for long running accounts that customers never looked at or that simply have way too many misconfigured resources). Whenever I execute the call I however keep running into 400 Bad Request statuses, and seem to be blind for my mistake. The call I'm trying to execute is the following:
curl -X POST \
'<a href="https://api2.redlock.io/v2/alert?alert.status=open&detailed=true" target="_blank">https://api2.redlock.io/v2/alert?alert.status=open&detailed=true</a>' \
-H 'Content-Type: application/json' \
-H 'Host: api2.redlock.io' \
-H 'x-redlock-auth: my-very-special-secret-auth-key' \
-d '{
"timeRange": {
"type": "absolute",
"value": {
"startTime": 1572244614366,
"endTime": 1569649014366
}
}
}'
When attempting it with a GET request to the below URL (of course with the x-redlock-auth header set) it also returns a 400 Bad Request. When using relative time of 1 month it just works as expected.
<a href="https://api2.redlock.io/v2/alert?alert.status=open&timeType=absolute&startTime=1572244614366&endTime=1569649014366&detailed=true" target="_blank">https://api2.redlock.io/v2/alert?alert.status=open&timeType=absolute&startTime=1572244614366&endTime=1569649014366&detailed=true</a>
Regards
10-28-2019 12:30 PM
Your start time is Oct 28th and your end time is Sept 28th. Have you tried flipping the values to see if it still results in a 400?
10-28-2019 12:30 PM
Your start time is Oct 28th and your end time is Sept 28th. Have you tried flipping the values to see if it still results in a 400?
10-29-2019 12:12 AM
Thanks @ebeuerlein! Did I mention I seemed to be blind for my own mistake?
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!