Skip to content
Jay edited this page Oct 22, 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

Using the API requires the API URL and an API token. The API URL is your help desk system URL (excluding the locale) appended with /api. In our example below, the system URL is https://www.example.com/support.

An API token can be generated by going to Settings -> General -> API Tokens in the operator panel. https://docs.supportpal.com/current/API+Tokens

$apiUrl = 'https://www.example.com/support/api';
$apiToken = 'JF9veGtKLw&8lVddyL9z14n&E3Y9JA65';

These are fed to the SupportPal class to initialise the client.

$supportPal = new \SupportPal\ApiClient\SupportPal($apiUrl, $apiToken);

Usage

All supported API endpoints can be accessed through the getApi function.

$api = $supportPal->getApi();

Example: Fetching Tickets

To fetch tickets (GET /ticket/ticket endpoint), you would need to call the getTickets function.

$tickets = $api->getTickets();

If you needed to filter the tickets, for example only fetch open tickets, you can add filtering options in an array as a parameter to the call.

$tickets = $api->getTickets(['status' => 1]);

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