vrok/mw-api

v0.0.5 2024-03-04 14:03 UTC

This package is auto-updated.

Last update: 2024-09-06 16:04:59 UTC


README

版本:2024-03-04

wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.54/swagger-codegen-cli-3.0.54.jar -O swagger.jar
java -jar swagger.jar generate -i https://doku.mittwald-api.de/docs/swagger-public.json -l php -o mw-api --invoker-package "Mittwald\Api" --api-package Functions --git-user-id vrok --git-repo-id mw-api

Mittwald客户接口

对于公开API,我们不提供所有组件和此文档的支持。我们保留在任何时候不通知或文档的情况下进行更改的权利。身份验证 ----------------- ### 使用用户名和密码 进行身份验证需要先前发放的API令牌。在请求中,可以通过Authorization头传递此令牌:http GET /v1/customers/123456 HTTP/1.1 Host: api.mittwald.de Authorization: Bearer {TOKEN-HIER-EINFÜGEN} 或者,您也可以通过查询参数access_token传递此令牌:GET /v1/customers/123456?access_token={TOKEN-HIER-EINFÜGEN} HTTP/1.1 Host: api.mittwald.de 要获取令牌,可以使用/authenticate端点。在这里,通过Mittwald客户中心的访问数据来进行身份验证。POST /v1/authenticate HTTP/1.1 Host: api.mittwald.de Content-Type: application/json Accept: application/jwt { "username": "r1234", "password": "{PASSWORT-HIER-EINFÜGEN}" } 此调用的返回值是一个API令牌。它有一个有限的有效期。 重要:客户端应用程序应该缓存API令牌的有效期,并且之后通过API请求新的令牌。### 使用Access-Token 对于需要永久访问Mittwald API的应用程序,不建议在应用程序中永久存储用户名和密码。相反,我们建议使用Access Token,该Token在用用户名和密码进行(初始)登录后创建,并随后使用。首先需要一个常规的API令牌,该令牌可以通过用户名和密码获取。用户名+密码以及获取的API令牌都不需要永久存储。它们仅用于创建Access Token,该Token随后可以在应用程序中永久存储:POST /v1/authentication/tokens HTTP/1.1 Host: api.mittwald.de Content-Type: application/json { "description": "我的应用程序" }上述请求的响应中包含实际的Access Token及其ID(示例数据):HTTP/1.1 201 Created Content-Type: application/json { "uuid": "2a91ce52-2058-404b-9959-ac7d2fbbbfbc", "token": "MW_aEQyz5j9YmTaamTq2N9X3d2sBDACLUoz", "crdate": "2021-08-23T14:06:17.580Z", "description": "我的应用程序" }响应中的uuidtoken可以用于后续的身份验证过程。速率限制 ------------- 为了确保系统稳定性,一些API端点对可执行请求的数量有限制。这种限制始终针对15分钟的时间窗口。对于受此类访问限制的API端点,HTTP响应中始终包含一个X-RateLimit头,其中包含可执行请求的最大数量。此外,每个响应还包括一个X-RateLimit-Remaining头,其中包含当前可用的请求数量:HTTP/1.1 200 OK Content-Type: application/json;charset=utf8 Content-Length: 1234 X-RateLimit: 1000 X-RateLimit-Remaining: 712 缓存 ------- 为了提高性能,API的一些请求可以从服务器端缓存中响应。如果一个请求由缓存响应,则响应中包含一个X-Cache: HIT头。当一个POSTPUTDELETE请求发送到相同的URI时,或者在一个GET请求中发送了Cache-Control: no-cache头时,会清除资源的缓存。

此PHP软件包是由Swagger Codegen项目自动生成的

  • API版本:1.4.1
  • 构建软件包:io.swagger.codegen.v3.generators.php.PhpClientCodegen

需求

PHP 7.4及以后版本

安装与使用

Composer

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

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/j-schumann/mw-api.git"
    }
  ],
  "require": {
    "vrok/mw-api": "^0.0.5"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门指南

请遵循安装流程,然后运行以下命令

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

$apiInstance = new Mittwald\Api\Functions\AccountsApi(
    // 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()
);
$account_identifier = "account_identifier_example"; // string | Name oder ID eines Accounts

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

$apiInstance = new Mittwald\Api\Functions\AccountsApi(
    // 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()
);
$account_identifier = "account_identifier_example"; // string | Name oder ID eines Accounts

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

$apiInstance = new Mittwald\Api\Functions\AccountsApi(
    // 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()
);
$account_identifier = "account_identifier_example"; // string | Name oder ID eines Accounts

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

$apiInstance = new Mittwald\Api\Functions\AccountsApi(
    // 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()
);
$customer_number = 56; // int | Kundennummer
$advised = false; // bool | Dieser Parameter steuert, ob auch Accounts zurückgeliefert werden sollen, für die eine Verwaltungsfreigabe besteht, aber nicht zur Kundennummer `{customerNumber}` gehören.'
$owned = true; // bool | Dieser Parameter steuert, ob Accounts zurückgeliefert werden sollen, die direkt der Kundennummer `{customerNumber}` gehören. Dieser Parameter hat standardmäßig den Wert `true`; über den Wert `false` können in Kombination mit dem Parameter `advised` ausschließlich Accounts abgefragt werden, für die eine Verwaltungsfreigabe besteht.

try {
    $result = $apiInstance->listAccountsByCustomer($customer_number, $advised, $owned);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountsApi->listAccountsByCustomer: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Mittwald\Api\Functions\AccountsApi(
    // 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()
);
$account_identifier = "account_identifier_example"; // string | Name oder ID eines Accounts
$install_path = "install_path_example"; // string | Filtert Software-Installationen nach Installationspfad (z.B. `&installPath=%2Fhtml%2Ftypo3`)

try {
    $result = $apiInstance->listSoftwareInstallationsByAccount($account_identifier, $install_path);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountsApi->listSoftwareInstallationsByAccount: ', $e->getMessage(), PHP_EOL;
}
?>

API端点文档

所有URI相对于https://api.mittwald.de/v1

模型文档

授权文档

所有端点均不需要授权。

作者