接口路径(新):http://api.okayapi.com/api/App/Market_Message/Post
接口路径(旧):http://api.okayapi.com/?s=App.Market_Message.Post
接口描述: 热门 接口超市-留言板-发布评论,使用前请先安装留言评论插件。
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
message_content | String | Required | 留言内容,支持HTML格式 | ||
message_nickname | String | Optaion | MAX: 32 | 留言用户名 | |
message_key | String | Optaion | MAX: 64 | 评论的唯一标识,例如某篇文章 | |
message_pid | Int | Optaion | 0 | MIN: 0 | 嵌套评论时的父级评论ID,没有时为0,目前最多支持三层嵌套 |
more_data | ArrayJSON Format | Optaion | 额外需要添加的数据,即客户端自定义添加的额外字段,需要JSON编码后传递。格式:data={"字段名1":"字段值1","字段名2":"字段值2"...},系统保留表字段(id, uuid, add_time, update_time, ext_data)将会被忽略。JSON在线解析及格式化验证 |
请求:
{OKAYAPI_API_HOST}/?s=App.Market_Message.Post&message_content=test&message_nickname=dogstar&app_key={你的app_key}&sign={动态签名}
返回:
{
"ret": 200,
"data": {
"err_code": 0,
"err_msg": "",
"id": 14
},
"msg": "当前请求接口:App.Market_Message.Post"
}
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口
$rs = OkayApiClient::request('App.Market_Message.Post',array('model_name'=>'okayapi_message','message_nickname'=>'小白','message_content'=>'小白接口服务大众'));
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[err_msg] =>
[id] => 5
)
[msg] => 小白开放接口:App.Market_Message.Post
)
*/
KEY | Type | Description |
---|---|---|
err_code | Int | 操作码,0表示成功,正数表示业务失败场景,负数表示系统失败场景 |
err_msg | String | 错误提示信息,err_code非0时参考此提示信息 |
id | Int | 新发布的评论ID |
接口路径(新):http://api.okayapi.com/api/App/Market_Message/Show
接口路径(旧):http://api.okayapi.com/?s=App.Market_Message.Show
接口描述: 接口超市-留言板-获取评论列表,根据唯一标识,获取评论数据,支持多级嵌套(最多三层)。使用前请先安装留言评论插件
Parameter | Type | Required | Default | Note | Description |
---|---|---|---|---|---|
HTTP_APPKEY | String | Required | MIN: 32 | Common Put Your APPKEY | |
message_key | String | Optaion | MAX: 64 | 评论的唯一标识,例如某篇文章,精准匹配此项 | |
order | Int | Optaion | 1 | 1按评论时间顺序显示,2按评论时间逆序 | |
page | Int | Optaion | 1 | MIN: 1 | 第几页 |
perpage | Int | Optaion | 10 | MIN: 1;MAX: 100 | 分页数量 |
more_select | ArraySeperated with , | Optaion | 需要返回的更多字段,例如客户端额外添加的自定义字段和小白系统字段。如:more_select=id,uuid |
请求:
{OKAYAPI_API_HOST}/?s=App.Market_Message.Show&app_key={你的app_key}&sign={动态签名}
返回:
{
"ret": 200,
"data": {
"err_code": 0,
"err_msg": "",
"total": 3, // 顶层评论总数
"items": [
{
"id": 8,
"message_nickname": "dogstar",
"message_content": "test",
"message_post_time": "2018-12-02 11:21:27",
"message_pid": 0,
"child": [
]
},
{
"id": 9,
"message_nickname": "dogstar",
"message_content": "test",
"message_post_time": "2018-12-02 11:21:28",
"message_pid": 0,
"child": [ // 第二层评论(即:评论的评论)
{
"id": 11,
"message_nickname": "dogstar",
"message_content": "test",
"message_post_time": "2018-12-02 11:21:45",
"message_pid": 9,
"child": [ // 第三层评论(即:评论的评论的评论)
{
"id": 13,
"message_nickname": "dogstar",
"message_content": "test",
"message_post_time": "2018-12-02 11:22:00",
"message_pid": 11
},
{
"id": 14,
"message_nickname": "dogstar",
"message_content": "test",
"message_post_time": "2018-12-02 11:35:13",
"message_pid": 11
}
]
},
{
"id": 12,
"message_nickname": "dogstar",
"message_content": "test",
"message_post_time": "2018-12-02 11:21:50",
"message_pid": 9,
"child": [
]
}
]
},
{
"id": 10,
"message_nickname": "dogstar",
"message_content": "test",
"message_post_time": "2018-12-02 11:21:29",
"message_pid": 0,
"child": [
]
}
]
},
"msg": "当前请求接口:App.Market_Message.Show"
}
<?php
// 引入文件
require_once dirname(__FILE__) . '/OkayApiClient.php';
// 调用小白开放接口
$rs = OkayApiClient::request('App.Market_Message.Show');
// 输出结果
print_r($rs);
/*
Array
(
[ret] => 200
[data] => Array
(
[err_code] => 0
[err_msg] =>
[total] => 6
[items] => Array
(
[0] => Array ( [id] => 1 [message_nickname] => 小白君 [message_content] =>小白接口真棒![message_post_time] => 2019-01-30 12:00:00 [message_pid] => 0 [child] => Array ( ) )
[1] => Array ( [id] => 2 [message_nickname] => dogstar [message_content] =>欢迎使用小白接口^_^ [message_post_time] => 2019-01-30 18:00:00 [message_pid] => 0 [child] => Array ( ) )
[2] => Array ( [id] => 3 [message_nickname] => 游客 [message_content] => 好用,五星好评! [message_post_time] => 2019-01-30 20:00:00 [message_pid] => 0 [child] => Array ( ) )
[3] => Array ( [id] => 4 [message_nickname] => 小白 [message_content] => 加油! [message_post_time] => 0000-00-00 00:00:00 [message_pid] => 0 [child] => Array ( ) )
[4] => Array ( [id] => 5 [message_nickname] => 小白 [message_content] => 小白接口服务大众 [message_post_time] => 0000-00-00 00:00:00 [message_pid] => 0 [child] => Array ( ) )
)
)
[msg] => 小白开放接口:App.Market_Message.Show
)
*/
KEY | Type | Description |
---|---|---|
err_code | Int | 操作码,0表示成功,正数表示业务失败场景,负数表示系统失败场景 |
err_msg | String | 错误提示信息,err_code非0时参考此提示信息 |
total | Int | 顶层评论总数 |
items | Array | 评论列表 |
items[].id | Int | 评论ID |
items[].message_content | String | 内容,支持HTML格式 |
items[].message_nickname | String | 留言用户名 |
items[].message_post_time | String | 留言时间 |
items[].message_pid | Int | 评论的父级ID,为0时表示没有父级 |
items[].child | Array | 评论的评论,多层嵌套 |
items[].moreSelect | string/int | 返回的更多的字段 |
Power by OkayAPI.com Contact us (WA: okayapi OR Email: chanzonghuang@gmail.com).
Timezone: America/New_York Dec/14/2024 09:10:20