Skip to content

Latest commit

 

History

History
633 lines (420 loc) · 16 KB

ServiceApi.md

File metadata and controls

633 lines (420 loc) · 16 KB

RMoore\Truenas\ServiceApi

All URIs are relative to https://truenas.local/api/v2.0.

Method HTTP request Description
serviceGet() GET /service
serviceIdIdGet() GET /service/id/{id}
serviceIdIdPut() PUT /service/id/{id}
serviceReloadPost() POST /service/reload
serviceRestartPost() POST /service/restart
serviceStartPost() POST /service/start
serviceStartedOrEnabledPost() POST /service/started_or_enabled
serviceStartedPost() POST /service/started
serviceStopPost() POST /service/stop
serviceTerminateProcessPost() POST /service/terminate_process

serviceGet()

serviceGet($limit, $offset, $count, $sort)

Query all system services with query-filters and query-options. query-options.extra can be specified as query parameters with prefixing them with extra. prefix. For example, extra.retrieve_properties=false will pass retrieve_properties as an extra argument to pool/dataset endpoint.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$limit = 56; // int
$offset = 56; // int
$count = True; // bool
$sort = 'sort_example'; // string

try {
    $apiInstance->serviceGet($limit, $offset, $count, $sort);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
limit int [optional]
offset int [optional]
count bool [optional]
sort string [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceIdIdGet()

serviceIdIdGet($id)

Query all system services with query-filters and query-options. query-options.extra can be specified as query parameters with prefixing them with extra. prefix. For example, extra.retrieve_properties=false will pass retrieve_properties as an extra argument to pool/dataset endpoint.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 56; // int

try {
    $apiInstance->serviceIdIdGet($id);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceIdIdGet: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id int

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceIdIdPut()

serviceIdIdPut($id)

Update service entry of id_or_name. Currently it only accepts enable option which means whether the service should start on boot.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 56; // int

try {
    $apiInstance->serviceIdIdPut($id);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceIdIdPut: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id int

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceReloadPost()

serviceReloadPost($service_reload)

Reload the service specified by service.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$service_reload = new \RMoore\Truenas\Model\ServiceReload(); // \RMoore\Truenas\Model\ServiceReload

try {
    $apiInstance->serviceReloadPost($service_reload);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceReloadPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
service_reload \RMoore\Truenas\Model\ServiceReload [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceRestartPost()

serviceRestartPost($service_restart)

Restart the service specified by service.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$service_restart = new \RMoore\Truenas\Model\ServiceRestart(); // \RMoore\Truenas\Model\ServiceRestart

try {
    $apiInstance->serviceRestartPost($service_restart);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceRestartPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
service_restart \RMoore\Truenas\Model\ServiceRestart [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceStartPost()

serviceStartPost($service_start)

Start the service specified by service.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$service_start = new \RMoore\Truenas\Model\ServiceStart(); // \RMoore\Truenas\Model\ServiceStart

try {
    $apiInstance->serviceStartPost($service_start);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceStartPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
service_start \RMoore\Truenas\Model\ServiceStart [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceStartedOrEnabledPost()

serviceStartedOrEnabledPost($body)

Test if service specified by service is started or enabled to start automatically.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = 'body_example'; // string

try {
    $apiInstance->serviceStartedOrEnabledPost($body);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceStartedOrEnabledPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
body string [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceStartedPost()

serviceStartedPost($body)

Test if service specified by service has been started.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = 'body_example'; // string

try {
    $apiInstance->serviceStartedPost($body);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceStartedPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
body string [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceStopPost()

serviceStopPost($service_stop)

Stop the service specified by service.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$service_stop = new \RMoore\Truenas\Model\ServiceStop(); // \RMoore\Truenas\Model\ServiceStop

try {
    $apiInstance->serviceStopPost($service_stop);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceStopPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
service_stop \RMoore\Truenas\Model\ServiceStop [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

serviceTerminateProcessPost()

serviceTerminateProcessPost($service_terminate_process)

Terminate process by pid. First send TERM signal, then, if was not terminated in timeout seconds, send KILL signal.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: basic
$config = RMoore\Truenas\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new RMoore\Truenas\Api\ServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$service_terminate_process = new \RMoore\Truenas\Model\ServiceTerminateProcess(); // \RMoore\Truenas\Model\ServiceTerminateProcess

try {
    $apiInstance->serviceTerminateProcessPost($service_terminate_process);
} catch (Exception $e) {
    echo 'Exception when calling ServiceApi->serviceTerminateProcessPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
service_terminate_process \RMoore\Truenas\Model\ServiceTerminateProcess [optional]

Return type

void (empty response body)

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]