amber-soft-dev / php.sdk
REST API SDK
1.0.6
2020-08-13 07:51 UTC
Requires
- php: >=5.6
- gregwar/cache: v1.0.12
- guzzlehttp/guzzle: 6.3.0
README
这是对REST API的包装。
安装
推荐的方式是使用composer。
composer require amber-soft-dev/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)
通过扩展查询获取对象数组