amber-soft/php.sdk

SDK for REST API

1.0.4 2017-09-25 06:20 UTC

This package is not auto-updated.

Last update: 2024-09-24 17:33:58 UTC


README

这是REST API的包装器。

安装

推荐方式 - 使用composer。

composer require amber-soft/php.sdk

使用

$config = array(
    'base_uri'=> 'https://your-url.amber-saas.com/',
    'endpoint'=>'API/V1.svc/',
    'user'=>'User1',
    'userPassword' => 'userpass',
    'lock_path' => '/tmp/lock.txt',
    'cacheDirectory' => '/tmp/cache'
);

$endpoint = $config['base_uri'] . $config['endpoint'];
$client = new \AmberSdk\Client\AppClient($endpoint, new \AmberSdk\Client\AuthManager($config));

AppClient的主要方法

getObject($name, $id)

通过标识符获取记录

getObjects($name, $filter = [], $size = null, $page = null)

获取数据对象记录列表,支持过滤和分页

saveObject($name, array $data)

允许为对象创建数据记录

updateObject($name, $id, array $data)

允许编辑对象的数据记录

execQuery(ExecutionQuery $query)

通过扩展查询获取对象数组