K吧
创建K吧
接口调用说明:
POST https://lxapi.lexiangla.com/cgi-bin/v1/teams
document
请求{
"data":{
"type":"team",
"attributes":{
"name":"通过开放接口创建的K吧",
"signature":"这是通过开放接口创建的K吧",
"type":1,
"is_secret": false
},
"relationships":{
"orgs": {
"data": [
{
"type": "staff",
"id": "ThreeZhang"
},
{
"type": "department",
"id": 1
}
]
}
}
}
}
参数说明:
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
team.name | 是 | 无 | K吧名称 |
team.signature | 否 | false | K吧介绍 |
team.is_secret | 否 | false | 是否保密K吧 |
team.type | 否 | 1 | K吧的类型;1:自定义;2:知识沉淀;3:项目管理;4:协会培训 |
team.orgs | 否 | 无 | 关联的成员对象,类型为orgs ,可传入多个staff ,department ,contacttag 对象 |
SDK封装方法使用示例:
$attributes = [
'name' => '通过开放接口创建的K吧',
];
$options = [
'signature' => '这是通过开放接口创建的K吧',
'type' => 1,
'is_secret' => false,
'orgs' => [
[
'type' => 'staff',
'id' => 'ThreeZhang'
],
[
'type' => 'department',
'id' => 1
]
]
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postTeam(StaffID, $attributes, $options);
document
响应201 Created 状态码
{
"data": {
"type": "team",
"id": "17bc1d68daae11e9a58410e7c61c70fc",
"attributes": {
"name": "通过开放接口创建的K吧",
"code": "k100001",
"signature":"这是通过开放接口创建的K吧",
"type":1,
"is_secret": false
}
}
}
编辑K吧
适用于更新K吧名称、K吧介绍以及对K吧成员的管理;对K吧成员管理时,需要全量覆盖之前的成员信息。
接口调用说明:
PATCH https://lxapi.lexiangla.com/cgi-bin/v1/teams/{team_id}
document
请求{
"data":{
"type":"doc",
"attributes":{
"name":"通过开放接口修改K吧"
},
"relationships":{
"orgs": {
"data": [
{
"type": "staff",
"id": "ThreeZhang"
},
{
"type": "staff",
"id": "FourLee"
},
{
"type":"staff",
"id": "TwoWang"
},
{
"type": "department",
"id": 1
}
]
}
}
}
}
SDK封装方法使用示例:
$options = [
'name' => '通过开放接口修改K吧'
];
$options += [
'orgs' => [
[
'type' => 'staff',
'id' => 'threeZhang'
],
[
'type' => 'staff',
'id' => 'FourLee'
],
[
'type' => 'staff',
'id' => 'TwoWang'
],
[
'type' => 'department',
'id' => 1
]
]
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchTeam($staff_id, $team_id, $options);
参数说明:
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
team.name | 否 | 无,不传递则不更新 | K吧名称 |
team.signature | 否 | 无,不传递则不更新 | K吧介绍 |
team.is_secret | 否 | 无,不传递则不更新 | 是否保密K吧 |
team.orgs | 否 | 无,不传递则不更新 | 关联的成员对象,类型为orgs ,可传入多个staff ,department ,contacttag 对象 |
document
响应200 状态码
{
"data": {
"type": "team",
"id": "17bc1d68daae11e9a58410e7c61c70fc",
"attributes": {
"code": "k100001",
"name": "通过开放接口修改K吧",
"signature":"这是通过开放接口创建的K吧",
"type":1,
"is_secret": false
}
}
}
404 Not Found 状态码
{
"errors":{
"detail":"不存在ID为`17bc1d68daae11e9a58410e7c61c70fc`的team资源"
}
}
K吧加入回收站
接口调用说明:
DELETE https://lxapi.lexiangla.com/cgi-bin/v1/teams/{team_id}/hide
参数说明:
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
team_id | 是 | 无 | K吧ID |
SDK封装方法使用示例:
$Lxapi = new \Lexiangla\Openapi\Api($app_key, $app_secret);
$response = $Lxapi->hideTeam('StaffID','ef380b7ca67911e89a9f10e7c61c70fc');
document
响应204 No Content 状态码
[]
404 Not Found 状态码
{
"errors": {
"detail": "不存在ID为`fab2ec5eefef11e99cb65254009b5a66`的team资源"
}
}
获取K吧列表
接口调用说明:
GET https://lxapi.lexiangla.com/cgi-bin/v1/teams
参数说明:
支持分页参数和排序:(通用说明?)
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
sort | 否 | -created_at | 排序参数,支持created_at 顺序或倒序,默认倒序 |
SDK封装方法使用示例:
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('teams', [
'page'=> 1,
'per_page' => 3,
//'sort' => 'created_at',
]);
document
响应200 OK 状态码
{
"data": [
{
"type": "team",
"id": "uuid1",
"attributes": {
"name": "动漫吧",
"code": "k100022",
"signature":"这是通过开放接口创建的K吧",
"type":1,
"is_secret": false
}
},
{
"type": "team",
"id": "uuid2",
"attributes": {
"name": "追剧吧",
"code": "k100020",
"signature":"这是通过开放接口创建的K吧",
"type":1,
"is_secret": false
}
},
{
"type": "team",
"id": "uuid3",
"attributes": {
"name": "推理吧",
"code": "k100019",
"signature":"这是通过开放接口创建的K吧",
"type":1,
"is_secret": false
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/teams?page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/teams?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/teams",
"per_page": 20,
"to": 3,
"total": 3
}
}