Receiving "queueItemDataDto must not be null" Error While Trying To Modify Queue Item attributes with Orchestrator API

I’m trying to use the Orchestrator API to modify the DeferDate of queue items through a PHP based web app. I’ve been been using this example as a guide: Queue items requests
I’m able to authenticate, create a new queue item and retrieve all the queue item information through a get request. This is a sample response

> Array ( 
[@odata.context] => [url]
[QueueDefinitionId] => 000000
[Encrypted] => 
[OutputData] => 
[AnalyticsData] => 
[Status] => New 
[ReviewStatus] => None 
[ReviewerUserId] => 
[Key] => 0000-0000-000
[Reference] => 000
[ProcessingExceptionType] => 
[DueDate] => 
[RiskSlaDate] => 2022-09-21T20:22:37.443Z 
[Priority] => Normal 
[DeferDate] => 2022-08-21T20:22:37.443Z 
[StartProcessing] => 
[EndProcessing] => 
[SecondsInPreviousAttempts] => 0 
[AncestorId] => 
[RetryNumber] => 0 
[SpecificData] => {
	"DynamicProperties":{
		"Arg1":"0000",
		"Arg2":true}} 
[CreationTime] => 2022-07-20T15:43:11.7Z 
[Progress] => 
[RowVersion] => AAAAA0000 
[OrganizationUnitId] => 0000
[OrganizationUnitFullyQualifiedName] => 
[Id] => 000000 
[ProcessingException] => 
[SpecificContent] => Array ( 
	[Arg1] => 0000
	[Arg2] => 1  ) 
[Output] => 
[Analytics] => )

After getting this information and storing it in an array (queueItemInfo), I make a PUT request as shown in the example, using the Priority, DueDate, RiskSlaDate, Reference and Progress fields in the body of the request. But instead of removing the SpecificContent, I modify the DeferDate value. Here’s the function I’m using:

> function Example($curl, $token, $arg1, $arg2, $queueName, $queueItemID, $queueItemInfo){
        $post_data = ['itemData' => ['Name' => $queueName, 'Priority' => $queueItemInfo['Priority'],'DeferDate' =>'2022-09-21T20:22:37.443Z', 'DueDate'=> $queueItemInfo['DueDate'], 'RiskSlaDate'=>$queueItemInfo['RiskSlaDate'], 'Progress'=> $queueItemInfo['Progress'], 'Reference'=>$queueItemInfo['Reference'],'SpecificContent' => ['Arg1' => $arg1, 'Arg2' => $arg2]]];
        curl_setopt_array($curl, array(
          CURLOPT_URL => [url] .'('. $queueItemID . ')',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => '',
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 0,
          CURLOPT_FOLLOWLOCATION => true,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => 'PUT',
          CURLOPT_POSTFIELDS => json_encode($post_data),
          CURLOPT_HTTPHEADER => array(
            'X-UIPATH-TenantName: '. [tenant_name],
            'X-UIPATH-OrganizationUnitId: '. [org_ID],
            'Content-Type: application/json',
            'Authorization: Bearer '. $token
          ),
        ));
        curl_exec($curl);
}

I keep getting the following error:

[message] => ; queueItemDataDto must not be null [errorCode] => 0 [traceId] => 00000 [resourceIds] =>

I have tried including other queue item fields in $post_data, like RowVersion and Status, but still get the same error. I have tried to modify a queue items with Successful and Retried status instead of new, but it did not make a difference. Has anyone else used the Orchestrator API for something similar and encountered this error? What could be missing from the PUT request?

Thank you in advance!

Hello,

So the error is saying the body of the request is coming out empty as per the swagger description

being the sample request body on this format

{
  "Name": "string",
  "Priority": "High",
  "SpecificContent": {},
  "DeferDate": "2022-07-26T17:34:21.803Z",
  "DueDate": "2022-07-26T17:34:21.803Z",
  "RiskSlaDate": "2022-07-26T17:34:21.803Z",
  "Reference": "string",
  "Progress": "string"
}

When analyzing your request body:

$post_data = [
            'itemData' => ['Name' => $queueName, 
        'Priority' => $queueItemInfo['Priority'],
        'DeferDate' =>'2022-09-21T20:22:37.443Z', 
        'DueDate'=> $queueItemInfo['DueDate'], 
        'RiskSlaDate'=>$queueItemInfo['RiskSlaDate'], 
        'Progress'=> $queueItemInfo['Progress'], 
        'Reference'=>$queueItemInfo['Reference'],
        'SpecificContent' => ['Arg1' => $arg1, 'Arg2' => $arg2]]];

I believe is being rendered like this, if that’s the case “itemData” is not defined in the API reference, therefore is saying queueItemDataDto is null

"itemData": {
  "Name": "string",
  "Priority": "High",
  "SpecificContent": {},
  "DeferDate": "2022-07-26T17:34:21.803Z",
  "DueDate": "2022-07-26T17:34:21.803Z",
  "RiskSlaDate": "2022-07-26T17:34:21.803Z",
  "Reference": "string",
  "Progress": "string"
}

not familiar with PHP (my bad if I got the language incorrectly) but have you tried sending your request body like this?

CURLOPT_POSTFIELDS => json_encode($post_data.itemData)

NOTE: my syntax may be incorrect

My recommendation is build your request from the bottom up, using as few attributes as possible and add them as you find a working point, If you haven’t, you may build and test your requests from the swagger UI before translating them into your app code. I left below a few resources.

If you are still experiencing problems, please attach your request body in JSON format and your request headers to further evaluate them.

API References (uipath.com)

Queue items requests (uipath.com)

Thank you for your help! I changed the format of the request and was able to modify the queue item DeferDate. It’s a bit odd, since all my other functions use $post_data → itemData → {Name: …} without any issue and that’s the format used in the Uipath Connector Guide.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.