'Why the HTTP Request return that the response is not in JSON format?
I built a flow that will generate an SSRS report as PDF dynamically from Dynamics by following this amazing article:
D365 Reports as PDF using Power Automate
After I have followed all the steps mentioned and performed different testing, sometimes the flow calls the API and output, as a result, the content type of the file, and sometimes it fails with the below response using the same report ID:
Inner Error returned:
""innerError": "<html><head><title>Object moved</title></head><body>\r\n<h2>Object moved to <a href=\"/_common/error/err.aspx?BackUri=&ErrorCode=0x80040216&Parm0=%0d%0a%0d%0aError%20Details%3a%20The%20report%20execution%20zui5ug55lnjeir45dkv0qt45%20has%20expired%20or%20cannot%20be%20found.&RequestUri=%2fReserved.ReportViewerWebControl.axd%3fReportSession%3dzui5ug55lnjeir45dkv0qt45%26Culture%3d1033%26CultureOverrides%3dTrue%26UICulture%3d1033%26UICultureOverrides%3dTrue%26ReportStack%3d1%26ControlID%3d76474ac98a844dd2acdc2ab483995da9%26RSProxy%3dhttps%253a%252f%252fams629srs.eur.reporting.cds.dynamics.com%252freportserver%26OpType%3dExport%26FileName%3dIJCF%26ContentDisposition%3dAlwaysAttachment%26Format%3dPDF%26rc%3aPrintOnOpen%3dtrue&user_lcid=1033\">here</a>.</h2>\r\n</body></html>\r\n"
Succeeded Run (Without any changes to the flow):
Actions scope screenshot:
-- Updated logic to handle HTTP request:
This flow really scares me as it might and might not work because I will be sending this report to our customers and I want to avoid any issue that might happen to the flow.
Kindly note that if you try to reproduce the same flow you will encounter the same issue.
Any idea what will be the workaround to handle this issue and to avoid flow failure?
Any help is highly appreciated.
Solution 1:[1]
I solve this issue adding "Accept: {asterik}/{asterisk}" to the Header. sometimes the request returns the redirect error in this case try to repeat the request making the same request again(using run after setting).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Miguel Ortega |