AtTask API - 添加休息时间 [英] AtTask API - Adding Time Off Hours

查看:21
本文介绍了AtTask API - 添加休息时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Chrome Advanced Rest Client 来测试 AtTask API.我得到了很多东西,但也得到了一些意想不到的结果.最新的是将新记录添加到 AtTask 休假日历时.

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.

我可以轻松地将休假时间添加到日历中.我使用 POST 方法,网址如下:

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

这将 11/24 到 11/28 之间的所有天都标记为休假.太好了,到目前为止.问题是它删除了指定用户的所有其他 rime-off 记录.我没有发出 DELETE,所以我不明白记录被删除的原因.更重要的是,我不明白如何防止它们被删除.

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.

再次感谢.

推荐答案

attask 中的休假被存储为一个集合,当您对集合进行编辑时,它将用更新中提供的日期替换集合数据.这就是为什么您的电话会删除现有数据.

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.

为了添加新的休假时间,您需要拨打 2 次电话,1 次获得现有休假时间,另外一次电话输入新日期的数据.

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

您的 get 电话将是

Your get call will be

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"
    }
]

}

一旦你有了这个,你就可以使用用户对象上的更新命令将你的新休假时间添加到集合中.请注意,您正在为系统中已有的休假提供 ID,而新的休假则没有提供 ID

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" } ] } 

这有点庞大和复杂,但这是目前在 API 中执行此操作的唯一方法.

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

这篇关于AtTask API - 添加休息时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆