I've found a few older Stackverflow-threads with the exact same question as this one but I can't get the solution to work.
Essentially, I'd like to add timeoffs and I've learnt that the only way to do so - according to [1] - is by making a PUT request, add existing objects into the collection and add new objects without the ID.
I've replicated the example as shown in [1]:
https://[DOMAIN].attasksandbox.com/attask/api/v5.0/RESVT?method=POST&sessionID=330051c6aaa24cb48edb3eab113d3a5a&updates=[{
"userID": "57270ab200030c6814a20577576f8399",
"startDate": "2016-08-12",
"endDate": "2016-08-15"
},
{
"ID": "575e7a27001a0dd8312a29defd886b78",
"objCode": "RESVT",
"startDate": "2016-06-01T00:00:00:000+0200",
"endDate": "2016-06-04T00:00:00:000+0200",
"userID": "57270ab200030c6814a20577576f8399"
}]&atomic=true
Response when executing the request:
{
"data": [
{
"objCode": "RESVT",
"ID": "575e7410001a031e06534a49b3032fd1"
},
{
"objCode": "RESVT",
"ID": "575e7410001a031f1ee4a0379c96d287"
}
]
}
But the only timeoff I see in the user's Timeoff page (and when searching for timeoff objects via the API) is the last object in the updates-parameter. In the example above it would be June 1-4. If I re-arrange the updates-array so June 1-4 is the first in the list then I see August 12-15 instead.
I've also tried using method=PUT instead of method=POST but then I get this message:
{
"error": {
"class": "java.lang.IllegalArgumentException",
"message": "Must specify an ID for each object that is edited"
}
}
What am I doing wrong?
[1]: php - AtTask API - Adding Time Off Hours - Stack Overflow AtTask API - Adding Time Off Hours