Orchestrator API - Start Transaction

Hello! I have a question regarding the Orchestrator API. In particular, the endpoint /odata/Queue/UiPathODataSvc.AddQueueItem. The endpoint requires a body in which the most importan field is the RobotIdentifier. If I pass a correct one, as well, I obtain to different responses depending on whether my SpecificContent attribute is empty or not.

  1. Specific Content not empty - I obtain a 200, receive data back and the item with that specific content changes status to In Progress.
  2. Specific Content null - I obtain a 204 but nothing seems to change in the queue. The documentation says that passing a null specific content should take the next available item in the queue and moved to In Progress.
  3. Specific Content empty json - Same 204 as before.

I wonder if anyone has had the same issue, or if I’m missing something obvious. Thank you very much for your help.

Hey @Alvaro_Jimenez

What’s your business case please ?

You want to add queue item through API ?

The main parameter what I believe is the Name, Priority.

Thanks
#nK

Hey @Nithinkrishna

I have managed to add queue items through the API. These appear as New, and I want to be able to change the status to In Progress. To do that, I need to use the endpoint I mentioned in the post. However, the documentarion says that if a null SpecificContent field is sent, then it takes the next available item in the queue and that’s what gets returned. But I can’t seem to make it work. The only successful calls to /odata/Queue/UiPathODataSvc.AddQueueItem are when passing something as SpecificContent, but in this case it creates a new item altogether, which I don’t want.

Thanks

Hey @Alvaro_Jimenez

So you are saying you have a queue item with no specific content & you want to change the item status to in-progress once that is added ?

Is that correct ?

Thanks
#nK

Hi @Nithinkrishna , sort of. I have a queue item with specific content and want to change its status, but I can’t do that unless I specify the field “SpecificContent” in the body request to the StartTransaction endpoint. However doing that creates and entirely new item with that SpecificContent, instead of looking in the queue and get the next available one.

Attached there is a screenshot of the Swagger documentation for clarification


o

Can you please elaborate on why you are trying to set an Queue Item/Transaction to “In Progress” via API? This would normally be handled under the scope of the Robot that is fetching the Queue Item to work on. (Whether it is Creating and immediately setting it to “In Progress”, or fetching the next valid queue item to process).

Otherwise if you were to adjust the Status then you would create a disassociation between the queue item and any robot that may work the queue item.

@codemonkee I know this would usually be handled by the Get Transaction activity from UiPath. What I am trying to do is understand how that activity works in the background, and check whether it was possible do the same via API.

Hey @Alvaro_Jimenez

The docs is saying the below…

This means that an existing item with details matched will be updated to in-Progress or a new item will be added & changed to in-Progress

Thanks
#nK

Hi @Nithinkrishna

I know, I do have the right name however the API does not behave as the docs say. If I do not provide a specific content, it does nothing. It doesn’t look for the next item whatsoever

2 Likes

Hey @Alvaro_Jimenez

Let me check this once for you

Thanks
#nK

1 Like

Check this article as it seems it is explaining your behavior https://uipath-survey.secure.force.com/CaseView/articles/Knowledge/Why-after-updating-a-queue-item-with-odata-QueueItems-Id-SpecificContent-is-lost

Hi! Thanks for the answer. I see in the discussion you link the issue was with a PUT call to QueueItems(id) and it makes sense as this is normal PUT behaviour. However in my case it is a POST call, and (just for the sake of completeness), adding the same Specific Content simply creates a new item (which makes sense since I’m not referencing the QueueItem Id ay any point). However setting it to null does nothing but returning an empty string anda 204 status code, which seems to differ from what the API documentation says.

Where I was going with my questioning a couple months ago is that it likely requires a reference to the Robot that is/will be processing the transaction item. The blurb at the top of the seems to elude to that as well.

Important!

Queue items can only be processed by Robots. For example, making a POST request to the /odata/Queues/UiPathODataSvc.StartTransaction endpoint requires information which is only available to the Robot.

Given that the Description of Queues/Queues_StartTransaction is

Stores data sent when processing of an existing or a new item starts.

And the description of SpecificContent has

If not null a new item will be added to the queue with this content before being moved to InProgress state and returned to the robot for processing.
If null the next available item in the list will be moved to InProgress state and returned to the robot for processing.

I suspect that you also need to provide a valid RobotIdentifier which is a unique key and to my knowledge is not exposed via API. It’s available in the dbo.Robots table if you have a private Orchestrator, or perhaps try inspecting the network packets when using Studio/Robot and Getting a Transaction Item to see how the interaction works.

Short of that, you likely will not get a clear answer on the forums, and would be likely get a more concrete answer if you open a Support Ticket.

Hi Tim! Thanks again for your interest. I have the robot key and I am able to process a transaction (by which I mean starting it using the StartTransaction endpoint which sets the status to In Progress which then allows me to set its result accordingly) and indeed it requires what they call RobotIdentifier for that, which I have. So it definitely can be done!

What bothers me is that doing that requires specifying the SpecificContent for that transaction, so it does not work if I add them in bulk before processing, for example. Basically the first “if statement” does what it says, the second one does not.

I’ll follow your advise and open a Support Ticket then. Best regards! :slight_smile:

Hi Alvaro, I recently found your post because I’m trying to do something similar. I would like to use an API call at /odata/Queues/UiPathODataSvc.StartTransaction but I need the RobotIdentifier for it to work. How do you find the RobotIdentifier key?

Hi Karl!

The RobotIdentifier, if I remember correctly, can be found under Key in the odata/Machines endpoint. If you have any troubles let me know! :smiley:

That was it - Thank you so much!

Hi Karl, I am working on something similar and just looking for some clarification. With regards to the RobotIdentifier, is this the machine that sent the request or the machine we want to handle the request?

From what I can tell, it just needs to be a valid robot associated with the “target” orchestrator and tenant. In my case, I am placing an HTTP call from a robot that is connected to a different Orchestrator. So the RobotIdentifier has to be a robot that is a part of the “target” Orchestrator. I hope that helps.

1 Like

Makes total sense thanks!