Knowledge Base

API Basics: URL, Methods, Return Formats, Authentication

Article ID: 388
Last updated: 9 Feb, 2024

How to Enable the API

By default API is disabled. You can enable it in Settings -> Admin -> Enable API access.
Check Secure API connection to configure the API to only accept requests using Secure Sockets Layer (SSL) by using HTTPS.
SSL encrypts the transmission, which protects your request and the response from being viewed in transit.

API URL

The API is accessed from the URL where your KBPublisher installed, formatted like so: http://[your_domain]/[kb_dir]/api.php
Example: http://www.domain.com/kb/api.php

API Authentication

The KBPublisher API requires that you authenticate every request by signing it. The process is described in Authorizing a Request.

API Version

KBPublisher version 8.0 supports API versions 1, 2 and 3. By default and if not specified, the API uses recent version.

You can specify the API version you want to use by adding the "version" query string parameter to your API URL.
Example: /api.php?call=articles&version=2

Return Format

Two return types are currently supported:

  • JSON (default)
  • XML

You can specify the return type by adding the "format" query string parameter to your API URL. If you want to receive JSON then you do not need to specify the output as that is the default.
Example: /api.php?call=articles&format=xml

Limiting Returned Fields

By default, all available fields are returned when you make a query. You can choose the fields you want returned with the "fields" query parameter. This is really useful for making your API calls faster and more efficient.
Example: /api.php?call=news&fields=id,title,datePosted

Example

Here is an example written in PHP
request.php.zip

Article ID: 388
Last updated: 9 Feb, 2024
Revision: 11
Access: Public
Views: 6008
Comments: 0
Attached files