AtTask Modifiers

2019-09-07 01:06发布

问题:

I have a few questions on the use of AtTask modifiers. I've been creating an application to pull and push data using the API, and it's been going really well so far -- the documentation is very good and the consistency of the service has been outstanding.

I have come up against a few things I wanted to ask about -- it may be that some of these were intentional design choices or limitations, but if not, getting them fixed would lead to drastically fewer API calls (which is a win on both sides).

  1. Can you use modifiers on "related" items? In other words, if I am querying the API for hours, can I use a _Mod on project:ID or project:DECustomFields? So far, it seems like the answer to both of those is no. I can query project for both of them with Mods and get the results I expect, but when I do it from hours, I don't get it.

  2. I created a modifier to search for all hours within a certain window of time, following the API documentation for a "between" mod, like this:

    entryDate=$$TODAY&entryDate_Range=$$TODAY-7d&entryDate_Mod=between...

    but it didn't work properly -- I had to switch the entryDate and _Range values to get the results, like this:

    &entryDate=$$TODAY-25d&entryDate_Range=$$TODAY&entryDate_Mod=between

Am I doing something wrong or is the documentation on http://developers.attask.com/api-docs/ backwards?

I will likely have more questions. I just started work on this app last week and have nearly all of the data movement working successfully -- just need to figure out a few of these details and will be able to move forward. :)

Thanks in advance for the help!

回答1:

I am glad you are enjoying working with the AtTask API and I am happy the documentation is helping. As for your questions:

1) You should be able to add a _Mod to any related field. For the below example I am using project:name from an hour search and only returning hour entries entered on a project which have "Test" in the project name. API Version should not matter for this functionality but if possible I would recommend using the latest version.

/attask/api/v4.0/hour/search?project:name=Test&project:name_Mod=contains

2) You are absolutely right and the documentation is backwards, we will fix this on the site shortly. The _Range value needs to be the higher of the two whether dealing with dates or numbers. Thanks for letting us know.

/attask/api/v4.0/hour/search?entryDate=$$TODAY-25d&entryDate_Range=$$TODAY&entryDate_Mod=between

The example above, which you provided, would be the correct way to use the between mod.

Good luck with your project and if you have any other questions or notice anything else amiss with the documentation on http://developers.attask.com/api-docs/ please let us know.