#### 接口路徑:https://dev.lingju.ai/httpapi/ljchat.do
<table style="width:100%">
<tbody>
<tr height="28" style="font-weight:bold;">
<td height="28" width="130px" >名稱</td>
<td colspan="3" >聊天接口</td>
</tr>
<tr height="28" style="font-weight:bold;">
<td height="28" >接口路徑</td>
<td colspan="3" >https://dev.lingju.ai/httpapi/ljchat.do</td>
</tr>
<tr height="28" style="font-weight:bold;">
<td height="28" >請求方式</td>
<td colspan="3" >post</td>
</tr>
</tbody>
</table>
#### http post請求示例:
~~~
post https://dev.lingju.ai/httpapi/ljchat.do
json格式串行化post上傳,注意請求的header需添加 'Content-Type':'application/json;charset=UTF-8'
{
"accessToken":"xxxxxxxxxxxxxxxxxxxxxx",
"input":"今天天氣怎么樣",
"lat":"23.12635",
"lng":"113.38776",
"city":"廣州",
"position":"廣東廣州",
"data":[
{
"target":ID,
"list":[]
}
]
}
~~~
#### 請求參數說明:
<table style="width:100%">
<thead>
<tr height="28">
<th width="130px">參數</th>
<th width="100px">數據類型</th>
<th width="130px">可需</th>
<th colspan="2" >描述</th>
</tr>
</thead>
<tbody>
<tr height="23" style="height:17.25pt">
<td height="23" >accessToken</td>
<td >String</td>
<td>必填</td>
<td colspan="2" >分配給開發者的專屬appkey,請妥善保管</td>
</tr>
<tr >
<td>input</td>
<td>String</td>
<td>必填</td>
<td colspan="2">文本輸入,長度:[1,300],取值:普通標點符號及中英文數字</td>
</tr>
<tr>
<td>city</td>
<td>String</td>
<td></td>
<td colspan="2">城市(該字段如果有參數,必須跟“lat”以及“lng”一起傳才有效)</td>
</tr>
<tr>
<td>lat</td>
<td>double</td>
<td></td>
<td colspan="2">緯度</td>
</tr>
<tr>
<td>lng</td>
<td>double</td>
<td></td>
<td colspan="2">經度</td>
</tr>
<tr>
<td>position</td>
<td>String</td>
<td></td>
<td colspan="2">具體位置</td>
</tr>
<tr>
<td rowspan="3">data</td>
<td rowspan="3">JsonArray</td>
<td rowspan="3"></td>
<td colspan="2">附帶的JSON數據</td>
</tr>
<tr>
<td>target</td>
<td>目標對象id,int類型</td>
</tr>
<tr>
<td>list</td>
<td>目標對象集合,Json,json<a href="http://doc.lingju.ai/@ljsdk/android_sdk" target="_blank">結構請參照</a></td>
</tr>
</tbody>
</table>
#### 接口返回JSON示例:
~~~
普通回復:
{
"answer":"廣州今天天氣預報說“大雨”,出門最好帶上傘。",
"status":0
}
帶指令的回復:
{
"answer":"{\"rtext\":\"好的\",\"outc\":0,
\"actions\":[{\"action\":\"QUERY\",
\"target\":{\"recyle\":0,\"id\":100,\"singer\":[\"周杰倫\"],\"release\":0,\"type\":\"歌曲\"},
\"hints\":{
\"success\":{\"text\":\"好的,為您播放周杰倫的歌\"},
\"failure\":{\"text\":\"抱歉,我找不到周杰倫的歌\"},
\"notsupport\":{\"text\":\"抱歉,我沒辦法播放歌曲\"}
}
},
{\"action\":\"SET\",
\"target\":{\"id\":300,\"origin\":\"QUERY\",\"control\":\"PLAY\",\"type\":\"AUDIO\"}}]}",
"status":0
}
~~~
#### 接口返回說明:
~~~
Content-Type:application/json;charset=UTF-8
~~~
<table style="width:100%">
<thead>
<tr height="28" >
<th height="28" width="130px">屬性名</th>
<th width="100px">數據類型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr height="23">
<td height="23" >status</td>
<td>int</td>
<td>狀態碼,0=成功,其它值則為錯誤碼,請參考錯誤碼表</td>
</tr>
<tr height="23">
<td height="23" >description</td>
<td >String</td>
<td>通常為空,出錯時會有錯誤信息</td>
</tr>
<tr >
<td>answer</td>
<td >String</td>
<td>普遍的回復文本或json結構的字符串文本,若為json文本,請參考<a href="http://doc.lingju.ai/android_sdk">指令說明文檔</a>解析,若僅用于普通聊天,建議忽略json文本,以"暫不知道該功能"作為回復。</td>
</tr>
</tbody></table>