PHP code example of rapidspike / rapidspike-api-wrapper-php

1. Go to this page and download the library: Download rapidspike/rapidspike-api-wrapper-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rapidspike / rapidspike-api-wrapper-php example snippets


composer 

/* 
 * Read one website
 * GET /websites/[uuid]
 */

# Segment (UUID) stored in varibale and passed as function param
$uuid = '30031b9b-5df8-4b19-8dfe-17bf5bac7654';
$Client->websites($uuid)->via('get');


stantiate the Client with authentication keys
$Client = new RapidSpike\API\Client("rapidspike-********", "**********************************************");

# Add paging query data to be turned into the query string
$Client->addQueryData(['page' => 1, 'per_page' => 10]);

# Read all websites
$Websites = $Client->websites()->via('get');

# Read the first website's stats by its UUID
$uuid = $Websites->data->websites[0]->website->uuid;
$Website = $Client->websites($uuid)->addQueryData(['stats' => 'status,average_response,passing_monitors,failing_monitors,total_monitors'])->via('get');