How to download Knowledge base articles from servicenow API

Phanikanth
Kilo Contributor

Hi,

I have the api and which gives response as articles, I want to download the articles in wiki/pdf  from the API. plz suggest.

find_real_file.png  

8 REPLIES 8

Maik Skoddow
Tera Patron
Tera Patron

Hi

why do you ask the same question four times? 

The fact that there is no way to download OOTB articles as PDF does not change just because you ask it often enough.

The only workaround I can imagine at the moment is building a Scripted REST API and generating the PDF version manually on server-side

Kind regards
Maik

Thanks for the response.

Hitoshi Ozawa
Giga Sage
Giga Sage

To download knowledge article as pdf, first convert the article to pdf file as an attachment to the knowledge page.

Example script to convert knowledge article to pdf attachment.

function convertKB2PDF(sysID ) {
  var v = new sn_pdfgeneratorutils.PDFGenerationAPI;
  var gr = GlideRecord('kb_knowledge');
  if (gr.get(sysID)) {
    var filename = gr.number;
    var html = gr.text.toString();
   var result = v.convertToPDF(html, "kb_knowledge", sysID, filename);
  }
}

convertKB2PDF('<knowdge article's sys_id>');

Then, the pdf file can be downloaded as an attachment on the Knowledge page.

OR, the file can also be downloaded using Attachment API.

I've provided a PowerShell script to download attachment file in the following thread.

https://community.servicenow.com/community?id=community_question&sys_id=9a9f54b31b994510ed6c9979b04b...