API example calls

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPrint this page

The API use is simple, any calls can be done using either GET or POST method.
The following methods are supported:

  • activate
  • deactivate
  • status-check
  • basic_check
  • plugin_information
  • code_information
  • theme_update
  • theme_information

Example of php call:

$args = array(
                            'sl_action'         => 'status-check',
                            'licence_key'       => $license_key,
                            'product_id'        => $product_id,
                            'secret_key'        => $secret_key,
                            'sl_instance'          => $domain_instance
                        );
$request_uri    = APTO_APP_API_URL . '?' . http_build_query( $args );
$data           = wp_remote_get( $request_uri );

if(is_wp_error( $data ) || $data['response']['code'] != 200)
    return;

$data_body = json_decode($data['body']);
if(isset($data_body->status))
    {
        if($data_body->status == 'success')
            {
                //the call was successfully
            }

        if($data_body->status == 'error')
            {
                //the licence key is invalid
            }
    }