Usage - skylord123/ImpactKI-PHP-API GitHub Wiki
Initialize the Class
First, initialize the ImpactAPI ckass.
$impactAPI = new ImpactAPI();
Executing API Commands
Using the API is very easy to do. Here is an example:
$response = $impactAPI
// Set your Auth key
->setAuthKey("IYWOFKeZ6jM6sO4fs2qSgQM2lWfgqwkH1YYXDxQa")
// Set command you want to run
->setCommand('test')
// Set the data you want to send into the API
->setData(array(
'name' => 'Freddy'
))
// Execute the API command
->execute()
// Now fetch the data returned from the API
->getResponse();
Parsing the Response
Now that you have executed the API command the response will be set in the $response
variable. The variable will be an array that looks as follows:
Array
(
[response] => 205
[message] => Hello Freddy!
[data] => Array
(
)
)
response
is the code returned from server. 205 is success and anything else is an error.message
is the message returned from the server. This will be an error message if the code is anything but 205.data
is an array returned from the server. An example is if you execute theadd_client
command it will return theclient_id
of the new client.