0

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.

4

1 回答 1

2

attask 中的休假存储为集合,当您对集合进行编辑时,它将用更新中提供的日期替换集合数据。这就是您的呼叫删除现有数据的原因。

为了添加新的休假时间,您需要拨打 2 次电话 1 来获取现有的休假时间,然后再拨打 1 次来输入带有新日期的数据。

注意-我使用的是我自己的数据,所以日期对我来说有点不同,但概念是一样的

您的接听电话将是

GET  /api/resvt/search?userID=[userID]&fields=endDate,startDate,ID

它返回类似的东西

{

"data": [
    {
        "ID": "547debb6000dea62198bd66b7c73e174",
        "objCode": "RESVT",
        "endDate": "2014-07-08T23:59:00:163-0600",
        "startDate": "2014-07-08T00:00:00:163-0600"
    },
    {
        "ID": "547debb6000dea61b8c695ba24918fe8",
        "objCode": "RESVT",
        "endDate": "2014-02-13T23:59:00:329-0700",
        "startDate": "2014-02-13T00:00:00:329-0700"
    }
]

}

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

PUT /attask/api/v4.0/user/[userID]?&sessionID=[sessionID]&updates={reservedTimes: [ { "ID": "547debb6000dea62198bd66b7c73e174", "objCode": "RESVT", "endDate": "2014-07-08T23:59:00:163-0600", "startDate": "2014-07-08T00:00:00:163-0600" }, { "ID": "547debb6000dea61b8c695ba24918fe8", "objCode": "RESVT", "endDate": "2014-02-13T23:59:00:329-0700", "startDate": "2014-02-13T00:00:00:329-0700" }, { "objCode": "RESVT", "endDate": "2014-02-14T23:59:00:329-0700", "startDate": "2014-02-14T00:00:00:329-0700" } ] } 

This is a bit bulky and complex but is the only way to do this in the API at this time.

于 2014-12-02T21:47:14.053 回答