Orchestrator API - How to get "@odata.count" via UiPathStudio

How to get @odata.count, which is visible in SWAGGER and is not available from the custom API library activity logic in UiPathStudio?
We have only 2 of 3 parameters to choose from:

  • OdataContext and Value but not OdataCount.

I have managed this problem by applying logic:
out_queueItemCount = getQueueItemResponse.Value.Count.ToString

out_queueItemCount is String argument

Unfortunately it is not perfect. With large volumes of data available in the queue (over 100,000), the query takes a very very long time, because we get all transaction parameters in response.
And this counter counts the number of these cases after all data has been loaded.

I narrowed my search in the search parameters (Request Body) by adding a filter to "Status" in the Select position:
The response comes faster, but it still takes a long time, and I do not need the details of the transaction just the counter itself.

Hi @Adrian_Star

Check this

Ashwin S

Thanks for reply, but I need to get OData Count in UiPath Studio.

Hi @Adrian_Star

try this

Ashwin S

Nope, it is not it.
I’m using custom library for API request and UiPath.Web.Activities activity in Studio (not POSTMAN and Orchestrator.HTTP.Request).

Someone can help?

a bit late, but in case anyone is still looking. My rookie workaround to get the odata.count was to do the following:

Get the HTTP Request response string and parse it through the RegEx:

string variable = Trim(system.text.RegularExpressions.Regex.Match(strJSONResponse,"(?<=odata.count"":)(.*?)(?=(,|\s*<\,))").ToString)

Look out for an extra quote after odata.count to escape the required quote odata.count"".


I used this thread as an example to adapt to my requirement, but you can test too somewhere like http://regexstorm.net/tester, mine detected the count

The regex pattern is (?<=odata.count":)(.?)(?=(,|\s<,))


All the best,

1 Like

If anyone is looking for the solution:
Use ‘Deserialize JSON’ activity and pass HTTP request ‘response’ as input and output will be JsonObject.
JsonObject(“@odata.count”).ToString will give the required value.


Or you can use this line in the Log Message activity:

@odata.count: " + Convert.ToString(JsonObject.GetValue(”@odata.count"))

1 Like