I'm using the Chrome Advanced Rest Client to test the AtTask API. I'm getting a lot of stuff figured out, but also getting some unexpected results. The latest is when adding new records to the AtTask Time Off Calendar.
I am able to easily add time off to the calendar. I am use the POST method, with the following URL:
https://COMPANY.attasksandbox.com/attask/api/v4.0/resvt?sessionID=SESSIONIDGOESHERE&userID=USERIDGOESHERE&startDate=2014-11-24T00:00:00&endDate=2014-11-28T23:59:59
This mark all the days between 11/24 through 11/28 as time off. Great, so far. The problem is that it removes all other rime-off records for the specified user. I am not issuing a DELETE, so I'm not understanding whey the records are being deleted. More importantly, I'm not understanding how to keep them from being deleted.
Once again, thanks in advance.
Time-off in attask is stored as a collection and when you make an edit to a collection it will replace the collection data with the date provided in the update. This is why your call is removing existing data.
In order to add a new time-off you will need to make 2 calls 1 to get exsisting time-off and one to enter the data back with the new dates.
note-I am using my own data so dates are a bit different for me but concept is same
Your get call will be
which returns something like
{
}
Once you have this you can add your new time off to the collection using an updates command on the user object. Notice you are providing IDs to the time-off that is already in the system and the new time-Off you are providing no ID
This is a bit bulky and complex but is the only way to do this in the API at this time.