API search for updated in the last day | Community
Skip to main content
Level 4
February 1, 2023
Solved

API search for updated in the last day

  • February 1, 2023
  • 2 replies
  • 1669 views

Hello-

 

Can anyone tell me if it's possible to query the API for all tasks updated in the last hour?  My search will be a bit more specific, ie tasks within this portfolio and with projects with X attribute.  But basically I want to look tasks updated in NOW-60 or something like that. 

I am basically creating my own event notification by querying the system every 15 minutes or so and looking for changes.  The reason I don't think I can use the even subscription is because I am monitoring a custom field for changes.  Is that correct?  Can I use the even subscription somehow?    

Thanks, Mollie

Best answer by Doug_Den_Hoed__AtAppStore

 

Hi @molliesh,

 

Although I didn't see "h" (Hour; or Minute or Second for that matter) listed as being supported, from a quick test, running this snippet in my browser's Workfront tab's URL did appear to return only the Task that was updated within the past hour, so I invite you to try it, too:

 

https://yourdomain.my.workfront.com/attask/api/v15.0/task/search?lastUpdateDate=$$NOW-1h&lastUpdateDate_Mod=gt

 

That said, it doesn't appear to support decimals (e.g. $$NOW-0.25h), so "to the hour" might be the lowest level of granularity possible.

 

I look forward to hearing how you make out!

 

Regards,

Doug 

2 replies

Doug_Den_Hoed__AtAppStore
Community Advisor
Doug_Den_Hoed__AtAppStoreCommunity AdvisorAccepted solution
Community Advisor
February 1, 2023

 

Hi @molliesh,

 

Although I didn't see "h" (Hour; or Minute or Second for that matter) listed as being supported, from a quick test, running this snippet in my browser's Workfront tab's URL did appear to return only the Task that was updated within the past hour, so I invite you to try it, too:

 

https://yourdomain.my.workfront.com/attask/api/v15.0/task/search?lastUpdateDate=$$NOW-1h&lastUpdateDate_Mod=gt

 

That said, it doesn't appear to support decimals (e.g. $$NOW-0.25h), so "to the hour" might be the lowest level of granularity possible.

 

I look forward to hearing how you make out!

 

Regards,

Doug 

Level 4
July 21, 2023

Just wanted to say thank you for this post from 6 months ago. Really helped me figure out the same problem today in record time!! All hail Doug!! 

Doug_Den_Hoed__AtAppStore
Community Advisor
Community Advisor
July 21, 2023

 

Thanks @molliesh -- I'm glad it helped!

 

Also, as I looked this one up again to refresh my memory on what problem it solved, I noticed (and Liked) the follow up from @lgaertner who figured out that "M" is the magic character to use in order to check for updates within the last certain number of minutes, vs the "h" hours I'd mentioned -- thanks Lars!

 

Regards,

Doug

William--
Community Advisor
Community Advisor
February 2, 2023

Doug's answer is great, so I'll speak to just the event subscription piece. 

You can create an event subscription for a value change on a custom field, but you have to make sure that tracking is enabled for that custom field in Setup > Interface > Update Feeds. Tracking is not available for calculated fields.

I'm sure you've seen this, but just in case here's a link to Event Subscription documentation:
https://experienceleague.adobe.com/docs/workfront/using/adobe-workfront-api/event-subscriptions/event-subs-api.html?lang=en

If you like my content, please take a moment to view and vote on my Idea Requests: https://tinyurl.com/4rbpr7hf