Bold360 and BoldChat Developer Center

Making your first REST API call

Follow these steps to send a REST API call to the server.

Prerequisites: Before performing this task, you should have a Bold360 AI account and knowledge base. If you need information about how to get these, see Prerequisites for using the REST API.

About this task: This procedure shows how to call a simple Bold360 AI REST API endpoint. The Bold360 AI REST API Reference shows all available API endpoints. This example uses the /api/kb/v1/faq endpoint, which loads an FAQ list from the knowledge base.

Note: Displaying FAQs is easy to do using the floating or embedded widget with no need to use the API. But, you might want to use the REST API in this way if you have plans to customize the FAQ formatting or if you are not using web widgets. This is one of the simplest REST API endpoints to use, because it is public and does not require an API key. It makes a good "hello world" style introduction to the Bold360 AI REST API.

Steps:

  1. Determine the base URL needed to send REST API endpoints to the server. The base syntax is as follows:

    https://{account_name}.{domain}/{API_endpoint}

    where:

    • Account name: This is the account_name portion of the URL you use when you log into the Bold360 AI Console.

    • Domain name: This is the domain portion of the URL you use when you log into the Bold360 AI Console. Typically, it is nanorep.co or nanorep.com. In rare cases, it may be some other domain.

  2. Paste the first portion of the URL into a text editor or other tool you will use when assembling REST URLs. For example: https://account_name.nanorep.co.
  3. Open the Bold360 AI REST API Reference in a separate tab or window. Navigate to the /api/kb/v1/faq endpoint, which you will use in this quickstart.
  4. Paste the /api/kb/v1/faq endpoint after the server portion of your URL. For example: https://account_name.nanorep.co/api/kb/v1/faq.
  5. Notice in the API reference that the FAQ endpoint requires the kb, account, and items parameters.
  6. Add the kb parameter to your URL and specify the name or ID of the knowledge base where your articles are stored. For example: https://account_name.nanorep.co/api/kb/v1/faq?kb=my_kb.

    • By ID number: To get the numeric ID for a knowledge base, go to Touchpoints > Widgets in the Bold360 AI Console. Enable Enforce KB in the Get the Code dialog. Copy the ID number from the setKB statement in the code provided.
    • By name: Knowledge base names are case sensitive. The correct capitalization of your KB is shown in the flyout list of KBs you can select from in the Bold360 AI Console. You can also see the correct capitalization for your KB in the drop-down list when you enable Enforce KB in the Get the Code dialogs accessed from Touchpoints > Widgets.
      Note: If you only have one KB, you won't see a list. In that case, the default KB name is "English".

  7. Add the account parameter to your URL. For example: https://account_name.nanorep.co/api/kb/v1/faq?kb=my_kb&account=account_name.

    Note: Most endpoints do not require the account name, and instead get the account information from the account_name portion of the URL, but some (like this one) require it.

  8. Add the items parameter to your URL. This parameter specifies how many FAQ items to return. For example: https://account_name.nanorep.co/api/kb/v1/faq?kb=my_kb&account=account_name&items=2.
  9. Open the Developer Tools in a browser. Paste your URL into the browser's address bar and press Enter. In the Network tab, view the results provided in response to the API call.



    Tip: Notice that if you remove a required parameter, you get an HTTP 403 error.

What next? Try other parameters supported by the /api/kb/v1/faq endpoint. For example:
  • cb: Provide a JSONP callback method to format the results returned.
  • labelId: Limits the results to articles that have been tagged with a specific label. Specify this ID as a hex value.