orglinker/external-integration

这个库将与 orglinker api 一起工作

v1.1 2021-10-05 12:39 UTC

This package is auto-updated.

Last update: 2024-09-05 21:03:29 UTC


README

orglinker API 库。要安装 orglinker 的实例,请访问 https://orglinker.com/

安装库 composer require orglinker/external-integration

首先您需要指定连接参数。

use \Orglinker\Orglinker;


$config = [
    'email' => 'test@orglinker.com',
    'password' => 'adminpassword',
    'domain_name' => 'your.domain.orglinker.com'
];
$orglinker = new Orglinker($config);
  • GET 请求
$data = [
    'table' => 'contact', //required field
    'page' => '1', //optional field
    'per-page' => '25', //optional field
    'conditions' => '[{"comparator":"=","field":"id","value":"3"}]', //optional field
];
echo $orglinker->getItems($data);

可用比较器:=, >=, <=, like, <, >

  • POST 请求
$data = [
    'table' => 'contact', //required field
    'objects' => '[{"name_loc":[{"ru":"contact1","en":" contact1"}], "short_name":" contact1"},{"name_loc":[{"ru":" contact2","en":" contact2"}],"short_name":"contact2"}]', //required field
];
echo $orglinker->createItems($data);
  • PUT 请求

在更新时,请确保在每个对象中传递 id!

$data = [
    'table' => 'contact', //required field
    'objects' => '[{"name_loc":[{"ru":"contact1","en":" contact1"}], "short_name":" contact1", "id":"12"},{"name_loc":[{"ru":" contact2","en":" contact2"}],"short_name":"contact2", "id":"13"}]', //required field
];
echo $orglinker->updateItems($data);
  • DELETE 请求
$data = [
    'table' => 'contact', //required field
    'ids' => '12,13' //required field
];
echo $orglinker->deleteItems($data);

与树一起工作的功能

  1. 当发起 POST 请求时,向对象传递 parent_id 字段 [{"name_loc":[{"ru":"treename","en":" treename "}], "parent_id":"25"}]

  2. 在移动(PUT 请求)时,请确保传递 move = 1 参数。在对象中,传递 id 和 parent_id(我们要移动的地方)。示例

$data = [
    'table' => 'contract', //required field
    'objects' => '[{"parent_id":"1","id":"25"},{"parent_id":"1","id":"24"}]', //required field
    'move' => '1', //required field
];
echo $orglinker->updateItems($data);