Expand my Community achievements bar.

Exporting A Report Via Fusion

Avatar

Level 5

Hello,

 

I am attempting to run a scenario that will export a report and send it to a destination on my desktop. Is this possible and if so what is the best method to go about it?

Topics

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

11 Replies

Avatar

Community Advisor

Hi @Eric_D_Miller can you clarify your requirements

  • you can export any report with a call to /attask/api-internal/report/export and setting the form data 
    exportOptions = {"exportFormat":"XLSX","exportTitle":"sven test assignments","exportType":"LIST","properties":{"detailObjCode":"PTLSEC","detailObjID":"685c24f300008535fbe3219a261d8cff"}}
    listOptions = {"viewID":"685c24f300008533d307b9ea023f0cb5","groupID":"0","filterID":"685d6e530005a5b241a4a46c07fffa43","reportID":"685c24f300008535fbe3219a261d8cff","isDrillDown":false,"listObjCode":"ASSGN","currency":null}
    filters = {}
    method = get​
  • Fusion doesn't send anything to your desktop. You can 
    • use WF modules to upload to WF
    • use Sharepoint/Offic modules to upload to Sharepoint or Office 365
    • use email modules (Office 365 or Email) to send email and attach a file (size limitations apply)

Avatar

Level 5

Sven,

 

My requirements are that a report be exported once a day. I would then like the file to replace a file. We may be able to move that file to a Sharepoint location to make this easier on us.

 

Can you explain where the call to the API is entered? Am I using the Custom API Call module?

Avatar

Community Advisor

Eric,

Yes you'll need the customAPI module. 
You could upload to Workfront (as well as a new version if you want history)

Avatar

Level 4

Hi @Sven-iX,

I'm trying to recreate Report export via Custom API call, but I'm not sure about some fields.

Is "detailObjID" / "reportID" the actual report ID that we need to export?

And what are "viewID" and "filterID"? I do not see such values in our report. Where can I find them?

 

Update:

I was able to get veiwID and filterID from report, but I guess I'm missing something.

 

My query:

viovi_0-1753308050764.png

and I get an error: 

The operation failed with an error. [422] Invalid Parameter: listOptions value "{"viewID":"6047a6ce003f42586dc19dea1904a608","groupID":"0","filterID":"6047a6ce003f425ccdd376d63f4fc548","reportID":"6047a6ce003f425e8ec64e347a564d9f","isDrillDown":false,"listObjCode":"ASSGN","currency":},JSON parsing error at line 1, column 206"

 

Avatar

Level 4

I tried to replicate the request by using the value from Workfront report export operation, but now I get 

RuntimeError

[422] null objCode

viovi_1-1755122080505.png

 

I tried adding objCode:PTLSEC, but get the same error.

What am I missing?

Avatar

Level 4

@Eric_D_Miller @viovi @Sven-iX 

I tried my luck with this and I found Sven's guidance really useful.

Here's how far I got:

tibormolnar_0-1760650703628.png

 

My findings:

1) Create your report in Workfront first. Then get the report ID (easiest from the URL in WF). Then obtain the viewID, groupByID (if any) & filterID (if any). I did this with a Workfront Custom API call module in Fusion:

tibormolnar_1-1760650808794.png

Mind the "fields" parameter. (You could also do fields=*)

2. You can't call the internal API in a Workfront Custom API Call module, because the path you type in the URL field is understood relative to https://<WORKFRONT_DOMAIN>/attask/api/<API_VERSION>/
so if you entered /attask/api-internal/report/export, that would be understood as https://<WORKFRONT_DOMAIN>/attask/api/<API_VERSION>/attask/api-internal/report/export - which is wrong.
So you need to use the HTTP / Make a Request module instead. That allows you to specify the full request URL:

tibormolnar_3-1760651304942.png

3. For the HTTP module to work, you need to send a sessionID in the header. To get a valid sessionID, run another Workfront Custom API call module first:

tibormolnar_4-1760651418161.png

The response body contains the sessionID that you need:

tibormolnar_5-1760651544058.png

4. Now, compile the parameters in the HTTP module as follows:

  • viewID and filterID is what you get in the 1st custom API call (Get Report Details)
  • groupID is what you get as groupByID, i.e. the grouping applied to the report
  • listObjCode is what you get as uiObjCode, i.e. the object type of your report
  • detailObjID and reportID both are the ID of your report
  • (I'm not sure what exportTitle is)

Also, remember to add the sessionID to the request header.

tibormolnar_0-1760820148826.png

 

All this seems to work, because this is the response I get:

tibormolnar_7-1760652675021.png

It seems that a file is actually generated with my report data. But I'm not sure how to get hold of that file or where that is stored. The file content seems not to be in the response, only some metadata.

(Note: exportTitle is derived from the title of my report in Workfront, the value sent in the exportOptions param was ignored.)

I tried searching for a document with ID = fileID, but that doesn't seem to exist.

I also tried if the api-internal has a file endpoint (attask/api-internal/file) but no joy.

@Sven-iX, can you maybe give us anoter pointer here?

Thank you,

Tibor

 

Avatar

Community Advisor

Hi @tibormolnar 
Nice work there! 
Note you can use the customAPI module and set the path for the first request (tick the "show advanced settings" at the bottom. 

However since for the download we seem to need to use the HTTP module anyway, might as well keep it. Just add this module to grab the file, using the session and the output values of the previous call.

 

Avatar

Level 4

tibormolnar_1-1761158738122.png

Hi @Sven-iX,

thank you, once again. This works perfectly.

I have a few more questions, gotchas though:

  1. Although the PTLSEC endpoint of the versioned API ("Get Report Details" module) returns the ID of the grouping (that's applied to the report) as groupByID, the /report/export endpoint of the Internal API ("Generate Report File" module) expects the same value in the request as groupID. - I've updated my previous comment to reflect this.
  2. No matter what exportTitle value I send to /internal-api/report/export, that is ignored. The name of the report file generated is derived from the Workfront report's title.
  3. I didn't manage to figure out what "isDrillDown" is. - Do you have and idea?
  4. I found that the end point used to generate the report file (/report/export) exists not only in the internal-api, but also in the api-unsupported.
  5. Do you have any idea how long the file generated via /api-internal/report/export exists for downloading via /export/api?
  6. I wondered how you picked up this knowledge so I searched for info about the internal API but couldn't find anything. Then I checked the requests that my browser sends when I export a report via the Workfront UI and found that they match what you've shared. - Is this how you learnt about them or is there any documentation available publicly?
  7. I understand the concept of the "API Path Override" option in the Custom API Workfront module, but I can't make it work. No matter what I put in that field, the versioned API is called. - Could you share the proper syntax, please?

Thank you,

Tibor

Avatar

Community Advisor

Hi @tibormolnar 

Apologies - I don't have more in-depth knowledge - as you describe, I got what I shared by looking at the DevTools when downloading a report in Workfront. So - no extra docs, sadly. I would expect the download file to be around for a few minutes, but again, I don't know 😞 

api-unsupported = api-internal. Unsupported because they may add/remove/change that API wheras vXX.X is static. The internal API can show features that are not yet available on the public API. I try to avoid relying on that as much as I can. 


Try this in the customAPI module

SveniX_0-1761656675345.png

 

 

Avatar

Level 4

I misunderstood you first, I thought that I need to use "API Path override" if I want to use the Workfront Custom API call module to generate the export file.

Now it is clear that I need to map the API version.

Thank you!

Avatar

Administrator

@Eric_D_Miller Just checking in — were you able to resolve your issue? We’d love to hear how things worked out. If the suggestions above helped, marking a response as correct can guide others with similar questions. And if you found another solution, feel free to share it — your insights could really benefit the community. Thanks again for being part of the conversation!



Kautuk Sahni