Report API | Community
Skip to main content
Level 2
February 13, 2019
Question

Report API

  • February 13, 2019
  • 21 replies
  • 3964 views
Does anyone use the Report API with success? We are trying to get get hours per time card grouped by a custom field on the company object. It seems like the Report API doesnt allow for "Group By" or "Filtering" beyond 1 level. EX /attask/api/v10.0/proj/report?apiKey=YOURKEY&hours:hours_AggFunc=sum&hours:timesheet:endDate=2019-02-09&company:name_2_GroupBy=true&owner:name_1_GroupBy=true Error: { "error": { "class": "com.attask.common.InvalidParameterException", "message": "Invalid Parameter: Search Parameter value \"hours:timesheet:endDate\"", "title": null, "msgKey": "exception.invalidparameter", "attributes": [ "Search Parameter", "hours:timesheet:endDate" ], "code": 1000 } } /attask/api/v10.0/proj/report?apiKey=YOURKEY&hours:hours_AggFunc=sum&hours:project:company:DE:Account Code_2_GroupBy=C&owner:name_1_GroupBy=true The Group By doesnt error, it just returns back an empty node. "Person 1": { "": { "dcount_ID": 32, "sum_hours_hours": 206.75, "owner_name": "Person 1" } }, "Person 2": { "": { "dcount_ID": 7, "sum_hours_hours": 23.68, "owner_name": "Person 2" } } Brad Baker
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

21 replies

Level 2
February 19, 2019
/attask/api/v10.0/proj/report?apiKey=YOURKEY&hours:hours_AggFunc=sum & hours:timesheet:endDate=2019-02-09 https://mrc.my.workfront.com/attask/api/v10.0/project/report?hours:hours_AggFunc=sum_hours:timesheet:endDate=2019-02-09 Try this one. Does it return the information you need? Nick Patel MRC Global
Level 2
February 20, 2019
https://mrc.my.workfront.com/attask/api/v10.0/project/report?hours:hours_AggFunc=sum_hours:timesheet:endDate=2019-02-09&company:name_2_GroupBy=true&owner:name_1_GroupBy=true&$$LIMIT=2000&apiKey=KEY Looks like this works fine now. it seems it was the & between sum and hours throwing your request string into separate pieces. Nick Patel MRC Global
Level 2
February 20, 2019
The $$ROLLUP function will give you multiple group levels as well. https://mrc.my.workfront.com/attask/api/v10.0/project/report?hours:hours_AggFunc=sum_hours:timesheet:endDate=2019-02-09&company:name_2_GroupBy=true&owner:name_1_GroupBy=true&$$ROLLUP=true&$$LIMIT=2000&apiKey=KRY Doug Patton": { "MRC Global": { "dcount_ID": 1, "owner_name": "Doug Patton", "company_name": "MRC Global" Nick Patel MRC Global
Doug_Den_Hoed_AtAppStore
Community Advisor
Community Advisor
February 20, 2019
Hi Brad, You are correct: for straight up aggregate functions, using a single report call can efficiently achieve the same thing as multiple search calls. I've just run a report test that is similar what you're trying to do, which I invite you to study so you can then build something similar that meets your needs. In it, I requested all of the hours entered by an owner whose name contains "Michael" (to keep the data set small) from time sheets with a particular end date (as you're doing), grouped first by owner name (as you're doing), grouped second by project name (similar to what you're doing with company, but as such companies are null in my test data), summing the hours , with a grand total for good measure. Here's what that looks like in the url (once you've logged in to YOURDOMAIN): https://YOURDOMAIN.my.workfront.com/attask/api/v10.0/ hour / report ? owner:name=Michael&owner:name_Mod=contains & timesheet:endDate=2018-10-15×heet:endDate_Mod=eq &fields= owner:name , project:name , hours & owner:name_1_GroupBy=true & project:name_2_GroupBy=true & hours_AggFunc=sum & $$ROLLUP=true I've also pasted the (obfuscated) results below, for reference. Regards, Doug [DDH: corrected to refer to project:name, vs project:portfolio:name] { data : { Michael 1 : { Project A : { dcount_ID : 1 , sum_hours : 1 , owner_name : "Michael 1" , project_name : "Project A" }, Project B : { dcount_ID : 1 , sum_hours : 3 , owner_name : "Michael 1" , project_name : "Project B" }, : { dcount_ID : 5 , sum_hours : 40 , owner_name : "Michael 1" , project_name : null }, $$ROLLUP : { dcount_ID : 7 , sum_hours : 44 } }, Michael 2 : { Project B : { dcount_ID : 2 , sum_hours : 2 , owner_name : "Michael 2" , project_name : "Project B" }, : { dcount_ID : 10 , sum_hours : 38 , owner_name : "Michael 2" , project_name : null }, $$ROLLUP : { dcount_ID : 12 , sum_hours : 40 } }, Michael 3 : { $$ROLLUP : { dcount_ID : 8 , sum_hours : 48 }, : { dcount_ID : 8 , sum_hours : 48 , owner_name : "Michael 3" , project_name : null } }, Michael 4 : { Project C : { dcount_ID : 11 , sum_hours : 30 , owner_name : "Michael 4" , project_name : "Project C" }, $$ROLLUP : { dcount_ID : 13 , sum_hours : 40 }, : { dcount_ID : 2 , sum_hours : 10 , owner_name : "Michael 4" , project_name : null } }, $$ROLLUP : { dcount_ID : 40 , sum_hours : 172 } } } Doug Den Hoed - AtAppStore Got Skills? Lend a hand! https://community.workfront.com/participate/unanswered-threads -------------
BradBaAuthor
Level 2
February 20, 2019
Still have issue with my custom field showing "" Brad Baker MMC - General
BradBaAuthor
Level 2
February 20, 2019
Doug, can you go more than 1 level deep with the grouping fields? So I would need to go from project -> company -> custom field. Your example works, but its never more than 1 level past ex project -> name Brad Baker MMC - General
BradBaAuthor
Level 2
February 20, 2019
EX Doug: v10.0/hour/report?owner:name=Brad&owner:name_Mod=contains×heet:endDate=2019-02-09×heet:endDate_Mod=eq&owner:name_1_GroupBy=true&project:company:name_2_GroupBy=true&hours_AggFunc=sum&$$ROLLUP=true { "data": { "Brad Baker": { "": { "dcount_ID": 10, "sum_hours": 40, "owner_name": "Brad Baker" } }, "$$ROLLUP": { "dcount_ID": 10, "sum_hours": 40 } } } Brad Baker MMC - General
BradBaAuthor
Level 2
February 20, 2019
Just FYI doug you said you grouped by portfolio:name but you didnt. If you do this: project:portfolio:name_2_GroupBy you will get the same issue I have. If the field you want to groupBy is more than 1 hop away, report api doesnt seem to be able to include the values. Brad Baker MMC - General
Doug_Den_Hoed_AtAppStore
Community Advisor
Community Advisor
February 20, 2019
Building on my previous example, Brad... This works ( "one hop" from hour to project :portfolioID ); in that it groups by Owner, then Project.PortfolioID: https://YOURDOMAIN.my.workfront.com/attask/api/v10.0/hour/report?owner:name=Michael&owner:name_Mod=contains×heet:endDate=2018-10-15×heet:endDate_Mod=eq&fields=owner:name,project :portfoioID ,hours&owner:name_1_GroupBy=true&project :portfolioID _2_GroupBy=true&hours_AggFunc=sum&$$ROLLUP=true And this works ( "two (and a half) hops" from hour to the DE:project:ProjectNews custom data parameter on a custom form behind each Project); in that it groups by Owner, then Project.ProjectNews: https://YOURDOMAIN.my.workfront.com/attask/api/v10.0/hour/report?owner:name=Michael&owner:name_Mod=contains×heet:endDate=2018-10-15×heet:endDate_Mod=eq&fields=owner:name, DE:project:ProjectNews ,hours&owner:name_1_GroupBy=true& DE:project:ProjectNews _2_GroupBy=true&hours_AggFunc=sum&$$ROLLUP=true This does not ( "three hops" from hour to project:portfolio:name ); in that it runs, but groups only by Owner (ignoring Project.Portfolio.Name, which is "too far"): https://YOURDOMAIN.my.workfront.com/attask/api/v10.0/hour/report?owner:name=Michael&owner:name_Mod=contains×heet:endDate=2018-10-15×heet:endDate_Mod=eq&fields=owner:name, project:portfolio:name ,hours&owner:name_1_GroupBy=true& project:portfolio:name _2_GroupBy=true&hours_AggFunc=sum&$$ROLLUP=true So, to get what you're after, I suggest you cheat using the concepts from our "http://store.atappstore.com/hows-my-portfolio/">How's My Portfolio blog post by pulling the custom data parameter "down" to the Project level in a calculated custom parameter (e.g. "ProjectCompanyName", or some other convention that Workfront will not confuse with a reserved field name) whose formula refers to the Project.Company.Name and group by it, instead ( "two (and a half) hops" from hour to DE:project:ProjectCompanyName ); thereby grouping by Owner then Project.ProjectCompanyName: https://YOURDOMAIN.my.workfront.com/attask/api/v10.0/hour/report?owner:name=Michael&owner:name_Mod=contains×heet:endDate=2018-10-15×heet:endDate_Mod=eq&fields=owner:name, DE:project:ProjectCompanyName ,hours&owner:name_1_GroupBy=true& DE:project:ProjectCompanyName _2_GroupBy=true&hours_AggFunc=sum&$$ROLLUP=true Regards, Doug Doug Den Hoed - AtAppStore Got Skills? Lend a hand! https://community.workfront.com/participate/unanswered-threads
BradBaAuthor
Level 2
February 20, 2019
How do you make the calculated field? Can you point me to documentation or provide the steps. I'm not a Workfront user per say, just a Software Engineer and our Admins aren't tech savy. Honestly Im not a fan of WF, always seems like we have to hack something to make it work. Not to mention it doesn't really work for software projects when you want to link to commits and builds and such, but that's another story. Brad Baker MMC - General