给文档,回答点赞操作
GET https://lxapi.lexiangla.com/cgi-bin/v1/likes?target_type=TARGET_TYPE&target_id=TARGET_ID
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
target.type | 是 | 无 | 点赞对象类型,支持:doc、answer、comment。 doc 表示文档的赞 answer 表示乐问回答的赞 comment 表示评论回答的赞 |
target.id | 是 | 无 | 点赞对象的ID |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('likes', [
'target_type' => 'answer',
'target_id' => 'answer_uuid'
]);
document
{
"data": [
{
"type": "like",
"id": "6ae89420193c11e8aba12063590908c3",
"attributes": {
"created_at": "2018-02-24 16:26:31"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "STAFF1"
}
}
}
},
{
"type": "like",
"id": "024c181c193901e8b24b19f87eaee149",
"attributes": {
"created_at": "2018-02-24 16:02:07"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "STAFF1"
}
}
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/likes?target_type=answer&target_id=d5f04360193811e8b2f0b926dc5ffc99&page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/likes?target_type=answer&target_id=d5f04360193811e8b2f0b926dc5ffc99&page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/likes",
"per_page": 20,
"to": 2,
"total": 2
},
"included": [
{
"type": "staff",
"id": "STAFF1",
"attributes": {
"name": "张三",
"english_name": "peter"
}
}
]
}
POST https://lxapi.lexiangla.com/cgi-bin/v1/likes
document
{
"data": {
"type": "like",
"relationships": {
"target": {
"data": {
"type": "doc",
"id": "cae375aae25a11e88d2c10e7c61c70fc"
}
}
}
}
}
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
target.type | 是 | 无 | 点赞对象类型,目前仅支持 doc、comment、answer。表示对文档、评论和回答点赞,参数为answer时不能为自己回答点赞 |
target.id | 是 | 无 | 点赞对象的ID |
$attributes = [
'target_type' => 'doc',
'target_id' => 'cae375aae25a11e88d2c10e7c61c70fc',
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postLike(StaffID, $attributes);
document
{
"data": {
"type": "like",
"id": "9d125daef1f411e8923801cf1916efb0",
"attributes": {
"created_at": "2018-11-17 11:29:14"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "ThreeZhang"
}
},
"target": {
"data": {
"type": "document",
"id": "2e4b7a86f1ea11e88555dd35d3856b57"
}
}
}
},
"included": [
{
"type": "staff",
"id": "ThreeZhang",
"attributes": {
"name": "张三",
"english_name": "ThreeZhang"
}
},
{
"type": "document",
"id": "2e4b7a86f1ea11e88555dd35d3856b57",
"attributes": {
"summary": "here is the titlehello world!",
"is_markdown": "0",
"content": "hello world",
"source": "original",
"reship_url": null,
"read_count": "0",
"comment_count": "0",
"like_count": "1",
"favorite_count": "0",
"md_content": ""
}
}
]
}
DELETE https://lxapi.lexiangla.com/cgi-bin/v1/likes/{LikeID}
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
LikeID | 是 | 无 | 资源对象类型为 like 的资源对象ID,即点赞ID |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->forStaff(StaffID)->delete('likes/LikeID');
document