livewatch-monitoring/livewatch-php-client

Livewatch 服务器监控 API

dev-master 2023-01-10 18:27 UTC

This package is auto-updated.

Last update: 2024-09-10 22:23:03 UTC


README

Livewatch 服务器监控 API

更多信息,请访问 https://www.livewatch.de

Livewatch Server Monitoring

安装与使用

要求

PHP 7.3 及以上版本。理论上也应在 PHP 8.0 上工作,但尚未经过测试。

Composer

要通过 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/livewatch-monitoring/livewatch-php-client.git"
    }
  ],
  "require": {
    "livewatch-monitoring/livewatch-php-client": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/LivewatchApi/vendor/autoload.php');

入门指南

注册免费账户

为了获取 API-Token,请前往 https://www.livewatch.de 注册免费账户。注册后,您可以在 https://www.livewatch.de/profile 找到您的个人 API 令牌。

第一步

请按照 安装过程 进行操作,然后运行以下命令

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



// Configure API key authorization: LivewatchToken
$config = LivewatchApi\Configuration::getDefaultConfiguration()->setApiKey('auth-livewatch-token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LivewatchApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('auth-livewatch-token', 'Bearer');


$apiInstance = new LivewatchApi\Api\AccountApi(
    // 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
);

try {
    $result = $apiInstance->accountDetails();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountApi->accountDetails: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://www.livewatch.de

模型

授权

LivewatchToken

  • 类型: API 密钥
  • API 密钥参数名: auth-livewatch-token
  • 位置: HTTP 头部

测试

要运行测试,请使用

composer install
vendor/bin/phpunit
  • API 版本: 1.0.0
    • 包版本: 1.1.3
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen