This is a TOPdesk API wrapper for Laravel. Using Laravel's HTTP Facade. Please check out the Version 1 releases if you do not use Laravel, or the original package from Innovaat.
- PHP 8.0 or higher
Via Composer
$ composer require fredbradley/topdesk
Ensure you understand the TOPdesk API configuration and your TOPdesk environment is set up to use the API. More details can be found at developers.topdesk.com.
Add three variables to your .env
file
TOPdesk_endpoint="" # Your TOPdesk url, ending in "`tas/`"
TOPdesk_app_username="" # Your username you wish to authenticate with
TOPdesk_app_password="" # Your application password for that username.
Our TOPdesk API implementation contains the following features:
- Simple login using application passwords.
- Automatic retry functionality that retries requests when connection errors or status codes >= 500 occur. We have experienced various instabilities with the TOPdesk API, and hopefully this minimizes these shortcomings.
- Direct function calls for much used api endpoints (
createIncident($params)
,getIncidentById($id)
,getListOfIncidents()
,escalateIncidentById($id)
,deescalateIncidentById($id)
,getListOfDepartments()
,createDepartment($params)
,getListOfBranches()
,createBranch($params)
among others). - Easy syntax for all other endpoints using
$api->request($method, $uri, $json = [], $query = [])
.
Now your API should be ready to use:
$incidents = TOPDesk::getListOfIncidents([
'start' => 0,
'page_size' => 10
]);
foreach($incidents as $incident) {
var_dump($incident['number']);
}
Many requests have been implemented as direct functions of the API. However, not all of them have been implemented.
For manual API requests, use the request()
function:
TOPDesk::request('GET', 'api/incidents/call_types', [
// Optional array to be sent as JSON body (for POST/PUT requests).
], [
// Optional (search) query parameters, see API documentation for supported values.
], [
// Optional parameters for the Guzzle request itself.
// @see http://docs.guzzlephp.org/en/stable/request-options.html
]);
Please see the changelog for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
- Fred Bradley - Laravel Wrapper
- Innovaat - Initial TOPdesk API PHP Wrapper
MIT. Please see the license file for more information.