kruegge82/billbee-php-sdk-api

Billbee REST API 的文档,用于连接 Billbee 账户到外部应用程序。## 端点 Billbee API 端点基本 URL 为 https://api.billbee.io/api/v1 ## 激活 您必须在 Billbee 账户的设置中启用 API。此外,您需要一个 Billbee API 密钥来标识您开发的应用程序。要获取 API 密钥,请发送电子邮件到 support@billbee.io 并告诉我们您正在构建的内容。

v1.0.3 2024-08-28 09:10 UTC

This package is auto-updated.

Last update: 2024-09-28 09:20:06 UTC


README

Billbee REST API 的文档,用于连接 Billbee 账户到外部应用程序。

端点

Billbee API 端点基本 URL 为 https://api.billbee.io/api/v1

激活

您必须在 Billbee 账户的设置中启用 API。此外,您需要一个 Billbee API 密钥来标识您开发的应用程序。要获取 API 密钥,请发送电子邮件到 support@billbee.io 并告诉我们您正在构建的内容。

授权和安全

由于您可以使用 Billbee API 访问私有数据,因此每个请求都必须通过 https 发送,并且必须

  • 包含一个有效的 API 密钥,以标识应用程序/开发者。它必须作为 HTTP 头部 X-Billbee-Api-Key 发送
  • 包含一个有效的用户登录,其中包含 billbee 用户名和 api 密码,形式为基本认证 HTTP 头部

节流

每个 API 密钥每秒 50 个调用。

与 Billbee 用户结合,每个 API 密钥每秒 10 个调用。

此外,每个端点都有一个最大每秒 2 个请求的节流,针对 API 密钥和 Billbee 用户的组合。

当您超过节流阈值时,API 将返回 HTTP 429 状态代码和一个 Retry-After-Header,指示您必须等待多少秒才能再次调用 API。

有关更多信息,请访问 https://www.billbee.io.

安装和使用

要求

PHP 7.4 及以上。也应在 PHP 8.0 中工作。

Composer

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

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/kruegge82/billbee-php-sdk-api.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

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

入门

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

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



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

// Configure API key authorization: ApiKeyAuth
$config = kruegge82\billbee\Configuration::getDefaultConfiguration()->setApiKey('X-Billbee-Api-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = kruegge82\billbee\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Billbee-Api-Key', 'Bearer');


$apiInstance = new kruegge82\billbee\Api\CloudStorageApi(
    // 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->cloudStorageApiGetList();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CloudStorageApi->cloudStorageApiGetList: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://app.billbee.io

模型

授权

为API定义的认证方案

基本认证

  • 类型:HTTP基本认证

API密钥认证

  • 类型:API密钥
  • API密钥参数名称:X-Billbee-Api-Key
  • 位置:HTTP头

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

support@billbee.io