HTTP 500 Error when trying to add queueitem via orchestrator API

p_qa
api

#1

Hello

When trying to add a queue item via the orchestrator api with a body like this:

{
  "itemData": {
    "Name": "Test",
    "Priority": "High",
    "SpecificContent": {
      "DynamicProperties": {"Test": "12345"}
    }
  }
}

The only response i get is an HTTP 500 error and

{
	"message": "An error has occurred.",
	"errorCode": 0
}
  • The bearer token has been set correctly and the user is authenticated, and i am able to get existing queueitems.
  • We are using Organization Units on the orchestrator, But this has been set correctly via the X-UIPATH-OrganizationUnitId header
  • The rights for both viewing queues and adding Transactions is granted for the authenticated user.

Anybody have any ideas on how to correctly add queueitems via the API?


#2

@SteffensenDK, you have missed out defer date and due date

Refer this for 2016.2,

{
“itemData”:
{
“Name”: “myFirstQueue_APItest”,
“Priority”: “Low”,
“SpecificContent”: {
“totalValue”: 1234567890
},
“DeferDate”: null,
“DueDate”: null
}
}

V2017

{
“itemData”: {
“Name”: “string”,
“Priority”: “High”,
“SpecificContent”: {
“DynamicProperties”: {}
},
“DeferDate”: “2018-02-06T11:53:10.531Z”,
“DueDate”: “2018-02-06T11:53:10.531Z”,
“Reference”: “string”
}
}

Regards,
Dominic :slight_smile:


#3

@Dominic
I’m using 2017.1
Your example gives me the same error 500


#4

Hello,
did you solved this error ?
I am having the exact same issue with 2018.1, and it does not work even if using the code from the Swagger documentation:

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 ?