Outlast Apps - API Access


Create an API key

Log in to the Outlast Apps admin panel, select app settings, and under API click the Generate new key button. This will generate an API key for this specific app and thus enable API access.

Important! Make sure the app type is set to emaillist. Only emaillist apps have API capabilities for now.

Copy the API key and API url from this interface and use these values in the functions below.

Send data via the helper

The only endpoint of the API for now is to create a new emaillist entry. To do this, you will use the Outlast Apps API helper, which is a library located in the outlast plugin of the framework. You will need to load and enable the outlast plugin for this to work!

Here is a code sample:

// Connect and save data in Outlast Apps admin
$result = $this->zajlib->outlastapi->send('OUTLAST APPS API URL', 'OUTLAST APPS API KEY', 'create');
// Copy api url and key from Outlast Apps admin!

By default, the data that is sent will be the $_POST data from the current request, but you can also specify the fourth parameter for the send function. This should be an array of data:

// Connect and save data in Outlast Apps admin
$result = $this->zajlib->outlastapi->send('OUTLAST APPS API URL', 'OUTLAST APPS API KEY', 'create', array('name'=>'Custom data'));
// Copy api url and key from Outlast Apps admin!

The helper method will return the decoded JSON of whatever the API returns. Usually, this will be one of the two:

{'status':'ok'}
{'status':'error','msg':'Invalid API KEY.'}

Important! No validation is done by the API endpoint. YOU MUST VALIDATE ALL DATA BEFORE SENDING IT TO THE API. Only programming errors, such as invalid api keys, bad urls, and other such errors will be reported.

You can then verify the result like so:

// Validate the result of the API request
	if($result->status != 'ok') return $this->zajlib->ajax($result->msg);
	else return $this->zajlib->ajax('ok');

Direct requests

You can of course send direct requests to the API. Documentation for this is available in the code of api.ctl.php.

[todo: add more docs]

Outlast Web & Mobile Development (c) 2023 | Privacy Policy |