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

Hi,
How to get @odata.count, which is visible in SWAGGER and is not available from the custom API library activity logic in UiPathStudio?
image
image
image
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:
image
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

Thanks
Ashwin S

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

Hi @Adrian_Star

try this

Thanks
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:

Assign
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"".

image

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<,))

image

All the best,
byuli

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.

6 Likes

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

ā€œ@odata.count: " + Convert.ToString(JsonObject.GetValue(ā€@odata.count"))

1 Like