vrok / mw-api
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.51.0
- phpunit/phpunit: ^8.0 || ^9.0
- roave/security-advisories: dev-latest
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": "我的应用程序" }
响应中的uuid
和token
可以用于后续的身份验证过程。速率限制 ------------- 为了确保系统稳定性,一些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
头。当一个POST
、PUT
或DELETE
请求发送到相同的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
模型文档
- AcceptGDPRContractRequest
- Account
- ApplicationToken
- ApplicationTokenInput
- ApplicationTokenResponse
- Article
- ArticleArticleOptions
- ArticleArticleOptionsMainCategory
- ArticleBenefits
- ArticleBenefitsDatabase
- ArticleBenefitsDatabaseMysql
- ArticleBenefitsDnsEditor
- ArticleBenefitsDomain
- ArticleBenefitsMailAddress
- ArticleBenefitsMailBox
- ArticleBenefitsMailBoxSpamDefender
- ArticleBenefitsServer
- ArticleBenefitsServerBackup
- ArticleBenefitsServerCronJob
- ArticleBenefitsServerFtpUser
- ArticleBenefitsServerHardware
- ArticleBenefitsServerSsh
- ArticleBenefitsServerSsl
- ArticleBilling
- ArticleConfigurationData
- ArticleConfigurationDataLimits
- ArticleContract
- ArticleContractUnit
- ArticleDescription
- ArticleGroup
- ArticleOption
- ArticleOptionPrice
- ArticlePrice
- ArticlePriceDefault
- ArticleUpgradeOption
- AuthenticationRequest
- AuthenticationResponse
- BankData
- Bankdaten
- Benefit
- BenefitBenefit
- Billing
- Cancellation
- CancellationRequest
- CancellationRequestDomains
- Cart
- CartItem
- CartItemInput
- Contact
- ContactUpdateRequest
- ContactWithPhone
- Contract
- Country
- CountryName
- CreateCustomerRequest
- CreateCustomerResponse
- CreateGDPRContractRequest
- CrossSellingOption
- Customer
- CustomerAccount
- CustomerAddress
- CustomerBillingSettings
- CustomerCategory
- CustomerContactData
- CustomerContract
- CustomerContractAccount
- CustomerPartner
- CustomerPaymentSettings
- DatabaseType
- Domain
- DomainAuthCode
- DomainDeletionRequest
- DomainItem
- DomainItemInput
- DomainNameTransfer
- DomainProxy
- DomainProxyDomain
- DomainProxyExpireDate
- DomainRegistration
- Error
- FormularBody
- FormularBody1
- FormularBody2
- GDPRContact
- GDPRContract
- GDPRContractPreset
- GDPRPDF
- GDPRTom
- GuestOperatingSystem
- Handles
- HostingOrderCustomer
- Invoice
- InvoiceAmount
- InvoiceItem
- InvoiceItemQuantity
- IpAddress
- MailAck
- MailAddress
- Message
- OfferRequest
- OfferRequestArticle
- OfferRequestArticles
- OfferRequestRecipient
- OptionalContact
- OptionalContactWithPhone
- OptionalContactWithTaxID
- OrderPreUpgradeCheck
- PartnerHostingOrderRequest
- PaymentReceipt
- PaymentReceiptKind
- PaymentSettings
- PromotioncodeValidierungsanfrage
- Recommendation
- Reseller
- SendMailForGDPRContractRequest
- ShopTestAgencyOrderRequest
- Software
- SoftwareCategory
- SoftwareExtension
- SoftwareInstallation
- SoftwareInstallationDatabase
- SoftwareInstallationSoftware
- SoftwareInstallationVersion
- StorageStatistics
- StorageStatisticsAccounts
- StorageStatisticsDetails
- StorageStatisticsItem
- StorageStatisticsItemList
- StorageStatisticsMeta
- Subdomain
- SubdomainCreationBody
- TestAccountOrderRequest
- TestAgencyOrderRequest
- TestHostingOrderCustomer
- Ticket
- TicketAccount
- TicketAnswer
- TicketAnswerInput
- TicketAnswerInputAuthor
- TicketAuthor
- TicketCustomer
- TicketInput
- TicketInputAccount
- TicketInputAuthor
- TopLevelDomain
- UpdateContact
- UpgradeCase
- UploadGDPRPDFRequest
- Verifizierungsanfrage
- Verifizierungscode
- VirtualAccount
- VirtualAccountInput
- 虚拟账户输出
- 游客统计
- 游客统计限制
- 游客统计限制文章
- 游客统计节流
- 游客统计访客信息
- 游客统计每日访客信息
- Webhook
- Webhook参数
授权文档
所有端点均不需要授权。