Skip to content
Kieran edited this page Nov 1, 2020 · 19 revisions

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.

Requirements

The API client has the following system requirements:

  • PHP 7.2.5+

Getting Started

Installation

The API client can be installed using Composer:

composer require supportpal/api-client-php

Configuration

Use of this library requires two components:

  • The base URL of your help desk, for example https://www.example.com/support or https://support.example.com
  • An API token

You can initialise the API client by creating an ApiContext.

$hostname = 'example.com';
$apiToken = 'JF9veGtKLw&8lVddyL9z14n&E3Y9JA65';

$apiContext = new \SupportPal\ApiClient\Model\ApiContext($hostname, $apiToken);
$sp = new \SupportPal\ApiClient\SupportPal($apiContext);

Additional Configuration Options

Installations from sub-directories:

If your help desk runs from a sub directory, for example https://example.com/support, you can initialise the client like so:

$apiContext = new \SupportPal\ApiClient\Model\ApiContext($hostname, $apiToken);
$apiContext->setPath('support');
Insecure connections:

By default the API client uses https. If you haven't setup an SSL certificate for your help desk you can switch to http:

$apiContext = new \SupportPal\ApiClient\Model\ApiContext($hostname, $apiToken);
$apiContext->setScheme('http')->setPort(80);
Disable SSL vertification:

If you're using a self-signed certificate, you will need to disable SSL verification:

$apiContext = new \SupportPal\ApiClient\Model\ApiContext($hostname, $apiToken);
$requestDefaults = new \SupportPal\ApiClient\Model\RequestDefaults;
$requestDefaults->disableSsl();
$sp = new \SupportPal\ApiClient\SupportPal($apiContext, $requestDefaults);

Usage

Find all the supported endpoints under the Reference section in the Wiki sidebar.