Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Retrieve a report using API

Avatar

Level 2

Is there any way to retrieve a specific report using the API ?

Is there a way to download the report using the API in XLSX or CSV format?

Appreciate if you can share the snippet of the sample code that downloads the report using the API.

Thank you

Jay

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

API
3 Replies

Avatar

Employee

Hi Jay,

You can retrieve the report definition, but not the contents of the report. It would look something like this:

Step 1: Get the report definition

/attask/api/v11.0/ptlsec/{GUID}?fields=objObjCode,filter:*,groupBy:*,view:*

...this should give you a list of filter criteria, how it is grouped, and the columns in the view.

Step 2: Pull the same info (assuming no grouping)

/attask/api/v11.0/{1.objObjCode}/search?{mapped string from 1.filter response}&fields={mapped string from 1.view response}

Hope this is helpful.

CC. @Darin Patterson - inactive‚ ‚

Avatar

Level 2

Hi Jeremy

Thanks for your response and help.

Step#1 gave me a response.

In Step#2, here's my request

/attask/api/v9.0/CUST/search?id=<A Customer ID>&sessionID=<My Session ID>

gives a response

{"error":{"message":null,"title":null,"msgKey":"exception.attask","attributes":[""],"code":0}}

Could you please let me know what I am missing ?Also, what does it mean "mapped string"?

Much appreciated.

Thank you

Jay

Avatar

Employee

You bet, Jay.

Going forward, I would suggest contacting our support team at 844-306-4357 to go through this in more detail and to answer any additional questions you have. (They are equipped with API resources who can further assist you and can schedule time with you.)

For now, I'm guessing it is because you are using version 9.0 of the API. Your "id" parameter is also supposed to be "ID" and you cannot search on the customer object. You have to search against any other object and pull in Customer details.

/attask/api/v11.0/USER/search?customerID={SOME_CUSTOMER_ID}&$$LIMIT=1&sessionID=...

On the first search we could probably be a bit more selective... we definitely don't need to pull in any reports with the "CUST" objCode. You might add a filter to the first query to return just reports created by the customer as native reports won't have custom data fields on them.

/attask/api/v11.0/ptlsec/{GUID}?objObjCode=CUST&fields=objObjCode,uiObjCode,filter:*,groupBy:*,view:*,definition

Here are a few other things to note:

  1. objObjCode=CUST //This will exclude any shipped reports (like customer reports)
  2. uiObjCode // This will return which object the report is for (TASK, PROJ, etc)
  3. definition // I missed this one previously, this gives you the Matrix, Aggregator, Chart, and Prompt definitions for your report — in case a custom field is being used in one of those