As a newcomer to web services and JavaScript, I am facing a challenge with calling a web service that returns a PDF file in a specific format. Here is the link to view the PDF: https://i.stack.imgur.com/RlZM8.png
To fetch the PDF, I am using the following code snippet:
var url="https://........../......./..../..";
var options = {
"rejectUnauthorized": false,
"method": "GET",
"url": url,
"headers": {
"Authorization": "Basic EJFHUygdiAISDGIF",
"Content-Type": "application/json"
}
};
request(options, (err, res) => {
if (res.statusCode == 200 ) {
conversation.logger().info("pdf:" + res.body); // in order to check the content of the pdf in the platform i use
}
});
I am currently struggling with downloading or displaying the PDF content. Any assistance on this matter would be greatly appreciated.