caplinked/caplinked-api-php

Caplinked API (PHP SDK) - 文档安全和共享

dev-master 2018-04-20 01:20 UTC

This package is not auto-updated.

Last update: 2024-09-21 15:23:12 UTC


README

概览

Caplinked API的PHP SDK。

核心信息安全端点,用于管理您关于文件/文件夹、用户/组和权限、上传/下载、动态水印、DRM(数字版权管理)等功能。

访问Caplinked获取更多信息。

要求

PHP 5.4.0及更高版本

安装与使用

Composer

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

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

    require_once('/path/to/caplinked-api-php/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门

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

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

date_default_timezone_set('UTC');

$key = '0c1da72601ca7c39df77a317d93c1caefccxxxxx';
$secret_key = 'cad02b1a2593862c5f151a5b8496f6e60c8581c82697ad706d8930bbd56xxxxx';
$user_resource_key = '1b62543ca4f8311e9bd0e628705d76fb6acxxxxx';

$config = Caplinked\Configuration::getDefaultConfiguration();
$config->setApiKey('cl-api-key', $key);
$config->setApiKey('cl-api-secret-key', $secret_key);
$config->setApiKey('cl-api-user-token', $user_resource_key);
//$config->setDebug(true);
$api_client = new Caplinked\ApiClient($config);

$api_instance = new Caplinked\Api\UsersApi($api_client);

try {
    $result = $api_instance->getUsersMe();
    var_dump($result['first_name']); // string(23) "Arons"
} catch (Exception $e) {
    echo 'Exception when calling UsersApi->getUsersMe: ', $e->getMessage(), PHP_EOL;
}

?>

API端点文档

所有URI相对于https://sandbox.caplinked.com/api/v1

模型文档

授权文档

请参阅入门中的示例