Can't get OData filters to work for Complex Types in Orchestrator API

Does Orchestrator not fully implement OData v4.0?

I’ve read about a few ways to query into complex JSON data in the official OData v4.0 docs here (Basic Tutorial · OData - the Best Way to REST), but none of them work on an Orchestrator QueueItem. I can’t figure out why not.

According to the OData documentation, I should be able to filter by complex types a few ways:

  1. Filter on Complex Type: $filter=contains(SpecificContent/Username, ‘JAMES.BABB’)
  2. Search: $search=‘JAMES.BABB’
  3. Nested Filter in Expand: $expand=SpecificContent($filter=Username eq ‘JAMES.BABB’)

I want to filter the returned QueueItems by SpecificContent/Username, but none of the above methods work, even though the OData v4.0 documentation says they should. I am able to run simple filters, like ($filter=Status eq ‘Successful’) but anything related to filtering by sub-items in the JSON doesn’t work.
Is this just impossible in Orchestrator’s API? I am using Postman to run these.

Here’s an example of the QueueItem JSON data returned from {orchestrator_url}/odata/QueueItems:

“QueueDefinitionId”: 2814,
“AnalyticsData”: null,
“Status”: “Successful”,
“ReviewStatus”: “None”,
“ReviewerUserId”: null,
“Key”: “f3775677-30fe-4c25-bb5c-7635ea68dbcd”,
“Reference”: “ChangeRentalProject-JeremyKing-1600365272”,
“ProcessingException”: null,
“SpecificContent”: {
“Username”: “JAMES.BABB”,
“JSON Input”: “{‘PROJECT_NUMBER’: ‘34526’}”

The guidance I’m getting on this is that most developers just grab the entire set of data, then use some .Net code to loop or LINQ the results to filter it. It’s clear that the full OData v4.0 spec is not implemented in Orchestrator.

As a workaround, if there’s an item you’d like to filter within the SpecificContent node, just use the SpecificData node, which is a serialized representation of the same. That way, you can create a filter using string comparison, like so:

{{orchURL}}/odata/QueueItems?$filter=Status ne ‘Successful’ and indexof(SpecificData,‘“Username”:“{{userName}}”’) gt 0

  • replacing the items in {{}} with the Orchestrator URL and Username, respectively

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.