Uploaded image for project: 'Opsgenie'
  1. Opsgenie
  2. OPSGENIE-1588

Incident API and Alert API using the "createdAt" condition display incorrect usage error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • Incidents - API
    • None

      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:

      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'

              dabe2ad0eda5 Arpith Patil
              wwung@atlassian.com Wei Wung (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: