Bug in AddQueueItem API

issue

#1

Hello,
I am having an error 500 when trying to invoke Orchestrator API to add queue items which contains complex information (i.e. not only primitives key-value pairs): the funny part is that even the Swagger API documentation example gives the error.

Here is an example:

Input:

{
  "itemData": {
    "Name": "Queue",
    "Priority": "High",
    "SpecificContent": {
      "DynamicProperties": {}
    },
    "DeferDate": "2018-04-02T15:41:44.806Z",
    "DueDate": "2018-04-02T15:41:44.806Z",
    "Reference": "string"
  }      
}

Output of Orchestrator 2018.1 APis:

   {
    "message": "queueItemParameters is null!",
    "errorCode": 0,
    "resourceIds": null
   }

The only way to make it work is to send only key-value pairs inside the “SpecificContent” field (you get the same error if you try to send anything different from a key-value, i.e. if you try to put a complex object inside or an array).
So the only way to work with the APIs is to send something like:

{
  "itemData": {
    "Name": "StageOneQueue",
    "Priority": "High",
    "SpecificContent": {
      "key1": "value1",
      "key2": 34,
      "myArrayItem1Field1": "item1Field1_value",
      "myArrayItem1Field2": "item1Field2_value",
      "myArrayItem2Field1": "item2Field1_value",
      "myArrayItem2Field2": "item2Field2_value"
    },
    "DeferDate": "2018-04-02T15:41:44.806Z",
    "DueDate": "2018-04-02T15:41:44.806Z",
    "Reference": "ref2"
  }
  
}

In this case it works, here is the full output:

{
"@odata.context": "https://vbox-uipath/odata/$metadata#queueItem/$entity",
"QueueDefinitionId": 2,
"OutputData": null,
"Status": "New",
"ReviewStatus": "None",
"ReviewerUserId": null,
"Key": "0f9d8618-cbe0-49a4-90d1-d898afe1a540",
"Reference": "ref2",
"ProcessingExceptionType": null,
"DueDate": "2018-04-02T15:41:44.806Z",
"Priority": "High",
"DeferDate": "2018-04-02T15:41:44.806Z",
"StartProcessing": null,
"EndProcessing": null,
"SecondsInPreviousAttempts": 0,
"AncestorId": null,
"RetryNumber": 0,
"SpecificData": "{\"DynamicProperties\":{\"key1\":\"value1\",\"key2\":34,\"myArrayItem1Field1\":\"item1Field1_value\",\"myArrayItem1Field2\":\"item1Field2_value\",\"myArrayItem2Field1\":\"item2Field1_value\",\"myArrayItem2Field2\":\"item2Field2_value\"}}",
"CreationTime": "2018-04-02T16:33:41.7712822Z",
"Progress": null,
"RowVersion": "AAAAAAABMO8=",
"Id": 80,
"ProcessingException": null,
"SpecificContent": {
    "key1": "value1",
    "key2": 34,
    "myArrayItem1Field1": "item1Field1_value",
    "myArrayItem1Field2": "item1Field2_value",
    "myArrayItem2Field1": "item2Field1_value",
    "myArrayItem2Field2": "item2Field2_value"
},
"Output": null
}

As you can see as part of the output, you get this interesting information:

....
 "SpecificData": "{\"DynamicProperties\":{\"key1\":\"value1\",\"key2\":34,\"myArrayItem1Field1\":\"item1Field1_value\",\"myArrayItem1Field2\":\"item1Field2_value\",\"myArrayItem2Field1\":\"item2Field1_value\",\"myArrayItem2Field2\":\"item2Field2_value\"}}",
....

So it seems the “DynamicProperties” field is not usable calling the API: this is an issue because it does not enable us to send lists as data inside a queue item.

To my understanding, considering the documentation as “correct”, this is a bug in the implementation.

Any feedbacks on this ?


#2

Hi, sorry for the late reply.
I have tested this on my end too, and can confirm that the sample request in swagger cannot be used as-is.
Actually DynamicProperties is more of an internal thing, and is simply the key that maps the SpecificContent into SpecificData.
We are double checking in order to better document all this, but for now it is safe to assume that SpecificContent should be an Object containing only basic JSON types (string, number, boolean, or null)
Nested Objects or Arrays result in the error you mentioned.
Please also note that there are some limitations regarding the characters for string values, which may require some tuning:
https://orchestrator.uipath.com/reference#section-adding-a-queue-item


#3

Hello,
thanks for replying: so in the current version of the APIs it is not possible to enqueue complex objects (eg. a list of items), am I right ?

Thanks and kind regards


#4

Just to be safe, we are double checking, but after running tests using the Studio activity, or even creating a request with swagger/curl, an array of values resulted in an error.
So yes, you are right.