Welcome to our Customer Service Portal

API & Integrations

How to import multiple articles in a batch with the API?

You can import a large number of articles in a batch with the following API endpoint:

https://[your_account].nanorep.com/api/kb/v1/import

Input parameters

You must define the following input parameters to use the API:

  • account: [mandatory] - the Bold360 ai account name (the & sign is not an acceptable character)
  • kb: [mandatory] - the knowledge base name
  • apiKey: [mandatory] - the API key associated with your Bold360 ai account
  • action: [mandatory] - import or update. Default value is import.
  • isPreview: [mandatory] - true or false. You can set whether you want to preview the data without uploading articles to the knowledge base. This way, you can validate the articles before upload. Default value is false.

Sample HTTP POST message

The following is an example API call, which imports articles into the English knowledge base of the account, called testaccount:

https://myaccount.nanorep.com/api/kb/v1/import?account=testaccount&kb=English&apiKey=1234567890abcdef

The body of the POST message defines your list of articles, which must be in JSON format. One batch / list can contain a maximum of 500 articles.

How to define the list of articles

The list of imported articles must be entered into the body of an HTTP POST message in JSON format. The following article fields can be defined:

  • titlestring [mandatory] - the title of the article
  • answerstring [mandatory] - the body of the article
  • labelstring – list of labels in a string delimited by | sign, for example: "label1|label2|labelN"
  • notesstring – the notes to the article
  • phrasingstring – phrasings of the article, which can be added in two ways:
    • titles in string delimited by | sign, e.g.: “title1|title2|titleN
    • list of phrasing data JSON in string format: "[{\"text\": \"title1\", \"autoComplete\": true }, {\"text\": \"titleN\", \"autoComplete\": false}]"
  • externalArticleSource: string - JSON string: "{\"provider\": \"ServiceNow\", \"id\": \"guid\", \"version\": 3}"
  • internalIdstring – Bold360 ai article ID, only for update purposes
  • contextstring - article context to create variations to the same article. The API cannot create new context, only existing ones can be used. It is a key-value pair in a JSON string, where the key is the existing context name, the value is the context value, for example: "{\"Device\": \"Android\", \"Country\": \"HU\"}"
  • expiryDatestring - the expiration date of the article

An example HTTP POST message body:

[
    {
        
"title""This is a test article",
        
"answer""Test article with test body.",
        
"label""test label|label2|this is a test",
        
"phrasing""[{ \"text\" : \"Test article title2\", \"autoComplete\": true }, { \"text\": \"Test article titleN\", \"autoComplete\": false }]",
        
"notes""Some test note.",
        
"context""{\"Device\": \"Android\", \"Country\": \"HU\"}",
        
"externalArticleSource""{\"provider\": \"ServiceNow\", \"id\": \"8b90a662-27a3-4554-be13-39ddec396e3c\", \"version\": 3}",
        
"expiryDate""2037-03-15",
        
"internalId": "900804242"
    },
    {
        
"title""This is also a test article, but without body",
        "answer"
"",
        "label"
"this is a test",
        "phrasing"
"[{ \"text\" : \"Test article title2\", \"autoComplete\": true }]",
        "notes"
"Test notes.",
        "internalId"
"900803342"
    }
]

Response

After importing the above sample messages, you receive the following response, which details that importing one article failed because there was no article body (answer) defined:

{
    
"importErrorLog": [
      {
        "rowId"
2,
        "message"
"Empty answer title or body"
      }
    ],
    "importedArticles"
: [
      {
        "internalId"
"900804242",
        "externalId"
"8b90a662-27a3-4554-be13-39ddec396e3c"
      }
    ],
    "Valid Articles"
1,
    "Failed Articles"
1
}