This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to query for a datetime in the ucmdb rest api?

In the end point /topology/queryNameWithParameters you can perform a predefined query and add your own attributeConditions to certain nodes.

How do you make conditions for datetime attributes? 

I tried the following json body:

{
   "name":"asy_api_JSM4MCI_Service",
   "nodes":[
      {
         "elementLabel":"Service",
         "attributeConditions":[
            {
               "attribute":"last_modified_time",
               "operator":"greaterThanOrEqual",
               "value":"2023-03-04T09:30:38.596Z"
            }
         ]
      }
   ]
}
and get the response
{
    "error": "The following error has occurred:  Value provided for Date attribute condition cannot be parsed. Please consult logs for more details"
}
I tried various formats for the value that adhere to ISO8601 but none seem to work. 
I would expect that at least the format works, that the UCMDB returns when GETting CI information from the REST API, but no. 
  • Suggested Answer

    0

    Hi,

    I got it working a while back using the following (epoch format) :

    "attributeConditions": [
         {
           "attribute": "last_modified_time",
            "operator": "greaterThanOrEqual",
            "value": "1684706400000"
       },
       {
           "attribute": "last_modified_time",
           "operator": "lessThan",
           "value": "1684792800000"
       }
    ]
    Hope it helps.