Learn the foundations for using the REST API, starting with authentication and some endpoint examples.
The easiest way to familiarise yourself with the API is through cURL. For most applications however, we recommend to use a wrapper library:
The SupportPro API uses Basic Authentication via API tokens.
Use the -u
flag to provide the API token. Note, the password field is ignored, so you can use a value of your choice, in this case we're using X
. Replace $token
with the value of your API token.
$ curl -i -u '$token:X' -X GET https://www.example.com/api/selfservice/type
HTTP Authorisation should work out of the box on Apache using the predefined .htaccess
. If you're having problems, please check the following:
mod_rewrite
is enabled on Apache.All
in your Apache configuration to permit user defined .htaccess
files.cgi
Apache handler to SuPHP
or FPM
.Please consult the web server documentation on how to enable HTTP Authorization headers.
To view all supported endpoints, please browse to https://api.supportpro.com.
If you use Multilingual Content the API will return the default value of content and translations will be accessible as a relation in the results. You can force the API to replace default content with a specific translation (if available) by appending a lang
parameter to the request.
Below is an example of fetching the Open status with and without the language param (set to French).
http://www.mydomain.com/api/ticket/status/1
{
"status": "success",
"message": null,
"data": {
"id": 1,
"name": "Open",
"colour": "#35a600",
"auto_close": 1,
"order": 1,
"created_at": 1486732738,
"updated_at": 1486732738,
"translations": [
{
"status_id": 1,
"name": "Ouvrir",
"locale": "fr"
}
]
}
}
http://www.mydomain.com/api/ticket/status/1?lang=fr
{
"status": "success",
"message": null,
"data": {
"id": 1,
"name": "Ouvrir",
"colour": "#35a600",
"auto_close": 1,
"order": 1,
"created_at": 1486732738,
"updated_at": 1486732738,
"translations": [
{
"status_id": 1,
"name": "Ouvrir",
"locale": "fr"
}
]
}
}
Article Number: 13
Author: May 17, 2024
Last Updated: Jul 26, 2024
Online URL: https://docs.supportpro.vn/article/rest-api-13.html