-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
Severity 3 - Minor
-
Issue Summary
When doing a List Incidents using the Incident API using the "createdAt" parameter, 2nd and 3rd suggested date format returns the same error usage message:
"message" : "Time is accepted in following formats: [dd-MM-yyyy] - [dd-MM-yyyy'T'hh:mm:ss] - [dd-MM-yyyy'T'HH:mm:ssz]"
The single tick marks around T and the lowercase "z" will generate the above usage error.
The same is true for the "createdAt" condition in the Alert API.
Steps to Reproduce
Run the following commands using the 2nd and 3rd suggested format:
- curl -X GET -H "Authorization: GenieKey xxxxxxxxxxxxxxxx" 'https://api.opsgenie.com/v1/incidents?query=createdAt%3E%3D%2226-05-2022%27T%2723:00:00%22'
- curl -X GET -H "Authorization: GenieKey xxxxxxxxxxxxxxxx" 'https://api.opsgenie.com/v1/incidents?query=createdAt%3E%3D%2226-05-2022%27T%2723:00:00z%22'
Expected Results
Was expecting a list of Incidents
Actual Results
The below exception is thrown:
{"message":"Time is accepted in following formats: [dd-MM-yyyy] - [dd-MM-yyyy'T'hh:mm:ss] - [dd-MM-yyyy'T'HH:mm:ssz]", "took":0.002,"requestId":"2fb5ad55-6d40-4be7-af50-9961cf116a07"}
Workaround
The following format with double quotes around the date works:
[dd-MM-yyyy] - [dd-MM-yyyyThh:mm:ss] - [dd-MM-yyyyTHH:mm:ssZ]
The quotes around the date time stamp is needed as well.
For example:
curl -X GET -H 'Authorization: GenieKey xxxxxxxxxxxxxxxx' 'https://api.opsgenie.com/v1/incidents?query=createdAt%3E%3D%2211-04-2023T17:21:08%22'
curl -X GET -H 'Authorization: GenieKey xxxxxxxxxxxxxxxx' 'https://api.opsgenie.com/v1/incidents?query=createdAt%3E%3D%2211-04-2023T17:21:08Z%22'