-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to SupportPal PHP API Client Wiki.
In this wiki, we will cover installing and using the client, all endpoints available including samples, and advanced settings.
The API client has the following minimum system requirements:
- SupportPal 5.0.0
- PHP 8.1
The API client can be installed using Composer:
composer require supportpal/api-client-php
Use of this library requires two components:
- The hostname of your help desk installation, for example for
https://www.example.com/support
it would beexample.com
or forhttps://support.example.com
it would besupport.example.com
. - An API token.
You can initialise the API client by creating an ApiContext
.
$hostname = 'example.com';
$apiToken = 'JF9veGtKLw&8lVddyL9z14n&E3Y9JA65';
$context = new \SupportPal\ApiClient\Config\ApiContext($hostname, $apiToken);
$api = new \SupportPal\ApiClient\SupportPal($context);
If your help desk runs from a sub directory, for example https://example.com/support
, you can initialise the client like so:
$context = new \SupportPal\ApiClient\Config\ApiContext($hostname, $apiToken);
$context->setPath('support');
If you have not enabled pretty URLs, you will need to set the path to include index.php
:
$context = new \SupportPal\ApiClient\Config\ApiContext($hostname, $apiToken);
$context->setPath('index.php/support');
By default the API client uses https
. If you haven't setup an SSL certificate for your help desk you can switch to http
:
$context = new \SupportPal\ApiClient\Config\ApiContext($hostname, $apiToken);
$context->disableSsl();
If you're using a self-signed certificate, you will need to disable SSL verification:
$context = new \SupportPal\ApiClient\Config\ApiContext($hostname, $apiToken);
$requestDefaults = new \SupportPal\ApiClient\Config\RequestDefaults;
$requestDefaults->disableSslVerification();
$api = new \SupportPal\ApiClient\SupportPal($context, $requestDefaults);
The library's core class \SupportPal\ApiClient\SupportPal
exposes an end point for each section of the API:
getCoreApi
getSelfServiceApi
getTicketApi
getUserApi
For example:
use SupportPal\ApiClient\Config\ApiContext;
use SupportPal\ApiClient\SupportPal;
$api = new SupportPal(new ApiContext('example.com', 'foo'));
echo $api->getCoreApi()->getSettings()->admin_folder; // "admin"
Find all the supported endpoints under the Reference section in the Wiki sidebar.