how to download knowledge base articles from servicenow through api

Phanikanth
Kilo Contributor

Hi,

I have an api which gives the KB(Knowledgebase ) articles and along with many fileds,I want to download the articles from the api. Please suggest.The below api returning text(artilce),I want to download using servicenow rest api.

API:https://dev82597.service-now.com/api/now/table/kb_knowledge?sysparm_query=short_descriptionLIKESpamand

output:

{
    "result": [
        {
            "parent": "",
            "short_description": "How to Deal with Spam",
            "roles": "",
            "wiki": null,
            "direct": "false",
            "rating": "",
            "description": "",
            "language": "en",
            "source": "",
            "sys_updated_on": "2014-12-19 15:54:36",
            "disable_suggesting": "false",
            "sys_class_name": "kb_knowledge",
            "number": "KB0000011",
            "sys_id": "0b48fd75474321009db4b5b08b9a71c2",
            "use_count": "0",
            "sys_updated_by": "johnoliver.mendoza",
            "flagged": "true",
            "disable_commenting": "false",
            "sys_created_on": "2014-09-09 23:31:10",
            "sys_domain": {
                "link": "https://dev82597.service-now.com/api/now/table/sys_user_group/global",
                "value": "global"
            },
            "valid_to": "2100-01-01",
            "retired": "",
            "workflow_state": "published",
            "text": "<p><span style=\"font-size: 18pt;\"><strong>How to Deal with Spam</strong></span></p>\n<p>Spam has increasingly become a problem on the Internet. While every Internet user receives some spam, email addresses posted to web sites or in newsgroups and chat rooms attract the most spam.</p>\n<p>To reduce the amount of spam you receive:
7 REPLIES 7

Hi,

The below response is coming from servicenow api which is not readable format,I want to download the  below highlighted  article in the form of word/pdf,and there is no link to download the article through api

"workflow_state": "published",
            "text": "<p><span style=\"font-size: 18pt;\"><strong>How to Deal with Spam</strong></span></p>\n<p>Spam has increasingly become a problem on the Internet. While every Internet user receives some spam, email addresses posted to web sites or in newsgroups and chat rooms attract the most spam.</p>\n<p>To reduce the amount of spam you receive:</p>\n<ul><li>Don&#39;t reply to spam</li><li>Be careful releasing your email address, and know how it will be used</li><li>Be proactive  <br /><br /></li></ul>\n<p style=\"font-size: 12pt;\"><strong>Don&#39;t reply to spam</strong></p>\n<p>If you reply to spam, the spammer or the automated program on the other end will then know that your address is connected to a live person, and the spammer will then bombard you with even more spam, and circulate your address to other spammers. It is critical that you pause and think before replying to any spam. Consider the following guidelines:</p>\n<ul><li>Setting up your email account to generate automatic responses while you are away can have the unfortunate side-effect of verifying your email address to every spammer that sends you spam. </li><li>If the message appears to come from a legitimate company, the company may have obtained your email address from some transaction between you and the company. In fact, you may have inadvertently provided your email address (e.g., if you didn&#39;t check a box marked Don&#39;t send me product updates). In these cases, it is usually safe to reply and ask to be removed from the mailing list. </li><li>

Hi

your answer is really giving the same incomprehensible code block a third time? 😮

In my email inbox I found that you want to download the article as a PDF file. Where is that answer gone?

Kind regards
Maik

Praveen Mariapp
Tera Contributor

@Maik Skoddow and others, I have same requirement as explained above.

 

The requirement is to make an API call to ServiceNow and get PDF file as a response. The content of the PDF file should be the content of the Knowledge article. To be specific, the content should be similar to the PDF file that we can download from the printable version of the knowledge article. Any help would be highly appreciated.