REST API

The REST API has been available since clearFusionCMS 1.3.0, it allows remote access to functions and data within the CMS and its modules. The REST API is available for developers that want to integrate their application with clearFusionCMS.

The API endpoint URI is structured in the form http://example.com/manager/api/1/service/method/ where 1 is the API version being accessed, service is the service to invoke the method on.

Authentication with an API Key

clearFusionCMS API uses HTTP Basic Authentication to authenticate an API request. API keys are created from the API Keys option on the dashboard, within the API Keys area new keys can be created and roles assigned to the keys. The roles assigned to a key control the access that key has to the system, for example a key without the core.usersadd permission will not be able to create users within the system.

When making an API call the API key is placed in the username field and the password is left blank e.g. for the key 9ce56c69fd319ecd5df69d4c8d1777a58caf7605 you send the header:

Authorization: Basic OWNlNTZjNjlmZDMxOWVjZDVkZjY5ZDRjOGQxNzc3YTU4Y2FmNzYwNTo=

Alternativly you can use the fusionLib HTTP client as in the following example which checks for the presence of a username 'example':

$client = new flHttpClient('http://example.com/manager/api/1/user/check/?field=username&value=example');
$client->setAuth('9ce56c69fd319ecd5df69d4c8d1777a58caf7605', '');
if($client->sendRequest() && $client->getResponseCode() == 200)
	var_dump(json_decode($client->getBody()));

Response

All responses are JSON encoded.

Status Codes

Statsus Code Description
200 Returned with sucessful requestes.
201 Returned by operations that create resources if the operation succeeded.
400 Returned when there is a problem with the request information.
401 Returned to request that the client authenticates against the service.
403 Returned if the API Key does not have permission to access a resource or perform a request.
404 Returned by requests that are looking for a resource that can't be found.



TOP