REST API cannot update time entries actuals
search cancel

REST API cannot update time entries actuals

book

Article ID: 220154

calendar_today

Updated On:

Products

Clarity PPM SaaS Clarity PPM On Premise

Issue/Introduction

We are trying to update timeentries with REST API.

when we tried to set the actuals as a map object like below:

{
  "actuals": {
     "amount": 3600
   }
}

We get the below error:

{ "resourceId": "5626501", "httpStatus": "400", "errorMessage": "TMA-1011: Missing or null value of required attribute taskId.", "errorCode": "timeadmin.timeentry.api.NULL_TASK" }

When specifying the TaskID we get a 200 status code but it removes any time entries and replaces it with null instead of the value we give.

{
  "taskId": 5175491,
  "actuals": {
     "amount": 3600
   }
}

So, we are not sure what the keyword in the 'actuals' map is suppose to be since the docs/examples shows it being just an integer

Environment

Release : Any

Resolution

First, you have to create the time entry. So pick a timesheet and a resource assigned to a task, with its taskId. TaskID is required for the time entry to be created. This is why you faced the initial error.

Example:

 "taskId": 5001000

}

Post this. This will create the timeentry.

 

Now you will have to update the timeentry and here you can use PATCH. A required part would be the segmentList. This is why it was erasing your data. You must specify the segments, example (test this):

{  
   "actuals": {  
     "segmentList": {  
       "segments": [  
         {  
           "start": "2021-07-19T00:00:00",  
           "finish": "2021-07-19T00:00:00",  
           "value": 0  
         },  
         {  
           "start": "2021-07-20T00:00:00",  
           "finish": "2021-07-20T00:00:00",  
           "value": 18000  
         },  
         {  
           "start": "2021-07-21T00:00:00",  
           "finish": "2021-07-21T00:00:00",  
           "value": 0  
         },  
         {  
           "start": "2021-07-22T00:00:00",  
           "finish": "2021-07-22T00:00:00",  
           "value": 0  
         },  
         {  
           "start": "2021-07-23T00:00:00",  
           "finish": "2021-07-23T00:00:00",  
           "value": 0  
         },  
         {  
           "start": "2021-07-24T00:00:00",  
           "finish": "2021-07-24T00:00:00",  
           "value": 0  
         },  
         {  
           "start": "2021-07-25T00:00:00",  
           "finish": "2021-07-25T00:00:00",  
           "value": 0  
         }  
       ]  
     }  
   },  
 "taskId": 5001000  
}

  • The other fields that give an error are not fields that you should be including.  
  • You can skip all of them and simply use the internal IDs as above.