# API - Overview

Overview

Maian Support has a web API that can perform actions from any device. This may be expanded in future versions, but at the moment the routines shown below are the only ones available. Maian Support utilises both XML and JSON for API operations. For XML, the Simple XML functions must be enabled on the target server.
Two free tools to help with API testing are Insomnia Rest Client & Postman.

How Does It Work?

Data is sent using an HTTP POST in the preferred language. Once the system receives a post it will validate it and perform the necessary actions.
You can url encode data for better performance and this is recommended when using XML.

XML or JSON?

Both JSON and XML do the same thing and perform in the same way. It's down to personal preference which one you use. There are no performance benchmarks that favour one or the other. XML has been around longer and is more familiar to programmers than JSON. The API system will auto detect your preferred method.

CDATA for XML

So that the xml doesn't invalidate, CDATA tags should be used where applicable. The following characters will invalidate xml if CDATA tags aren't used:
& < >
All text in an XML document will be parsed by the parser, but text inside a CDATA section will be ignored by the parser. The term CDATA is used about text data that should not be parsed by the XML parser.
A CDATA section starts with <![CDATA[ and ends with ]]>

API Key / API Url

Before you use the API, you must generate a unique key. This is so the system knows the API calls are genuine. You include this key in any call you make.
The url you post the data to is the full path to your Maian Support main index.php file with the "api" query string appended. For example, lets say you have your support system installed at:
http://www.example.com/helpdesk/index.php
Your API call url would be:
http://www.example.com/helpdesk/index.php?api=yes
Note that for legacy versions of Maian Support, the following also works:
http://www.example.com/helpdesk/index.php?p=xml

Available Routines

Please choose a routine and follow the instructions carefully.
Add Account (JSON / XML)
Add Ticket (JSON / XML)