composer require semstorm/semstorm-php-sdk
{
"require": {
"semstorm/semstorm-php-sdk": ">=3.0"
}
}
and then run update
composer update
include_once 'vendor/autoload.php';
use SemstormApi\Semstorm;
use SemstormApi\Monitoring\MonitoringCampaign;
Semstorm::init( __ACCESS_TOKEN__ );
$monitoringCampaign = new MonitoringCampaign();
print_r($monitoringCampaign->retrieve(12345));
In docs/examples/Monitoring
directory you can find examples with description and possible output.
Furthermore you can use MonitoringExamples.php file which will run multiple scripts and return its results. Just open docs/examples/MonitoringExamples.php
file, fill config data and run script to see how API works.
For more examples see docs/examples directory, where are many samples with exhaustive comment.
Documentation can be found in SEMSTORM API documentation pages.
In order to use SEMSTORM API, it is required to have valid access token. Access tokens are granted only to registered users in SEMSTORM. If you are registered user, log in to SEMSTORM panel, and go to access token page in profile. There you can generate or refresh your access token. When you have your access token you are ready to use SEMSTORM API.
Official API endpoint is https://api.semstorm.com/api-v3/
. All requests goes through this endpoint, and all of them must be authenticated by including 'services_token' parameter.
API have request limits. It is 1 request per second. If you make too many requests at once you will get error stating '503 Service Temporarily Unavailable. You are requesting too fast,(...)', this means you have to optimize your script to prevent further blocking.