I have a UIAPI project which use to generate SSRS reports and save as PDF file programmatically by using reportexecution2005.asmx web service with user credentials.
It works for SSRS 2016, but failed to SSRS 2017 or later.
I understand that the SSRS 2017 has provided a new feature: REST API to access SSRS objects. But I couldn't find how to use it to render reports and save as PDF file with users credentials.
Could you please give me some guidance how to make it work?
SQL Server Reporting ServicesA SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,911 questions Sign in to follow 1 comment Hide comments for this question Report a concern I have the same question I have the same question 0Hi @Pengxin Fan ,
Has your issue been resolved?
If you have any question, please feel free to let me know.
If the answer is helpful, please click "Accept Answer" and upvote it.
Best Regards,
Joy If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
rs.Url = ReportExecution2005EndPointUrl; rs.ExecutionHeaderValue = new ExecutionHeader();
var result = rs.Render("PDF", deviceInfo, out mimeType, out encoding, out encoding, out warning, out streamId); return result; >
1 comment Show comments for this answer Report a concern
Joyzhao-MSFT 15,576 Reputation points
2021-01-14T07:42:46.783+00:00
It is indeed not possible to pass the username and password via query parameters in standard HTTP auth. Instead, you use a special URL format, like this: http://username:password@example.com/ -- this sends the credentials in the standard HTTP "Authorization" header.
2. > Convert a PDF to byte array
string path = @"C:\MyFile.pdf"; byte [ ] a = File.ReadAllBytes( path ); string s = Convert.ToBase64String( a );
If the answer is helpful, please click "Accept Answer" and upvote it. Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
1 vote Report a concern Add commentHi OlafHelper-2800, Thank you for your reply. I did read samples, but couldn't find any examples to resolve my issue.
0 comments No comments Report a concern Add comment Joyzhao-MSFT 15,576 Reputation points 2021-01-11T03:13:03.957+00:00Hi @Pengxin Fan ,
As far as I know, there is no method available in RestAPI provided by Microsoft available here.
There is an alternative to generate report by utilizing Url Access (SSRS) URL access to the report server in SQL Server Reporting Services (SSRS) enables you to send commands to a report server through a URL request.
URL Access Syntax
URL requests can contain multiple parameters that are listed in any order. Parameters are separated by an ampersand (&) and name/value pairs are separated by an equal sign (=).
Export a Report Using URL Access
You can optionally specify the format in which to render a report by using the rs:Format URL parameter. The HTML4.0 and HTM5 formats (rendering extension) will render in the browser and for other formats, the browser will prompt to save the report output to a local file. For example, to get a PDF copy of a report directly from a native mode report server:
http://myrshost/ReportServer?/myreport&rs:Format=PDF
You can also provide parameters to this using syntax
http://myrshost/ReportServer?/activeusers&UserStatus=true&rs:Format=PDF