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 help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @Eric_D_Miller can you clarify your requirements
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
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?
Views
Replies
Total Likes
Eric,
Yes you'll need the customAPI module.
You could upload to Workfront (as well as a new version if you want history)
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:
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"
Views
Replies
Total Likes
I tried to replicate the request by using the value from Workfront report export operation, but now I get
[422] null objCode
I tried adding objCode:PTLSEC, but get the same error.
What am I missing?
Views
Replies
Total Likes
@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:
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:
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:
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:
The response body contains the sessionID that you need:
4. Now, compile the parameters in the HTTP module as follows:
Also, remember to add the sessionID to the request header.
All this seems to work, because this is the response I get:
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
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.
Hi @Sven-iX,
thank you, once again. This works perfectly.
I have a few more questions, gotchas though:
Thank you,
Tibor
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
Views
Replies
Total Likes
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!
Views
Replies
Total Likes
@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!