### 使用說明
接口地址:
Post http://www.tuling123.com/openapi/api
#### 輸入協議
~~~
{
"location": {
"province": "北京",
"city": "北京",
“county”:"海淀區",
"street": "信息路",
"nearest_poi_name": "上地環島南",
"latitude": "39.45492",
"longitude": "119.239293"
},
"appState": {
"appKey": "platform.fm",
"operateState": 1000
},
"info": "播放劉德華的小蘋果",
"userid": "userid",
key:"key"//測試apikey
}
~~~
#### 輸出協議
~~~
{
"appState": {
"appKey": "platform.music",
"operateState": 1000,
"parametes": {
"singer_name": "劉德華",
"song_name": "小蘋果"
}
},
"tts": ""
}
~~~
>字段說明
| 參數 | 說明 |
| --- | --- |
| appState |當前應用狀態(可選輸入,不輸入將默認使用上下文獲取當前應用狀態) |
| appKey | 當前應用唯一標識 |
| operateState | 當前應用狀態值 |
| nearest_poi_name | 最近街道名稱 |
| key | 該apikey關聯車載產品 |
| userid | 設備唯一標識 |
| info | 用戶輸入信息 |
#### 通訊錄上傳協議
接口地址:
Post http://update.tuling123.com/multibiz
>[info] 請求參數
~~~
{
"userid": userid,
"info": "|張三:1353743XXXX|阿財:1358073XXXX|"//注意上傳格式
}
~~~
>[success] 返回參數
~~~
{
"ret":0,
"text":"通訊錄上傳成功"
}{
"ret": 1,
"text": "解密失敗,您的加密邏輯存在異常!"
}
~~~
~~~
{
"ret": 1,
"text": "解密失敗,您的加密邏輯存在異常!"
}
~~~
#### 加密輸入協議
~~~
{
"key":apiKey,
"timestamp":456789,
"service_identify":"uploadphone", //上傳通訊錄特殊參數 ,通訊錄上傳必須加密
"data":TwPFGlIQk/yl2qDbNyuSQg9JMeV6aLdCS7yo6lT5Ia0=//加密后的輸入參數
}
~~~
#### 應用相關協議
###### 打電話
>[info] 請求參數
~~~
{
"key": "apikey",
"info": "給張三打電話",
"userid": "userid"
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "platform.phone",
"operateState": 2000,
"parametes": {
"address_blank": true,
"people_name": "張三",
"phone_number": "1353743XXXX"
}
},
"tts": "正在為您呼叫張三"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 進入電話應用 |
| 2100 | 接電話 |
| 2010 | 可撥打號碼 |
| 2000 | 立即撥打號碼 |
| 1000 | 結束該應用 |
| parametes內字段 | parametes字段詳解 |
| --- | --- |
| list | 多匹配 |
| address_blank | 有無通訊錄 |
| phone_number | 撥打號碼 |
| people_name | 撥打姓名 |
###### 視頻通話
>[info] 請求參數
~~~
{
"key": "key",
"info": "給張三打視頻",
"userid": "userid"
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "vehicle.video_call",
"operateState": 2000,
"parametes": {
"address_blank": true,
"people_name": "張三",
"phone_number": "1353743XXXX"
}
},
"tts": "正在向張三發送視頻請求"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 進入視頻通話應用 |
| 2100 | 接視頻 |
| 2010 | 可撥打號碼 |
| 2000 | 立即撥打號碼 |
| 1000 | 結束該應用 |
| parametes內字段 | parametes字段詳解 |
| --- | --- |
| list | 多匹配 |
| address_blank | 有無通訊錄 |
| phone_number | 撥打號碼 |
| people_name | 撥打姓名 |
###### 相聲
>[info] 請求參數
~~~
{
"key": "key",
"info": "打開相聲",
"userid": "userid"
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "vehicle.crosstalk",
"operateState": 1000,
"parametes": {}
},
"tts": "恩,播放相聲"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 打開相聲 |
| 1400 | 關閉相聲 |
###### 電臺
>[info] 請求參數
~~~
{
"key": "key",
"info": "打開相聲",
"userid": "userid"
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "vehicle.crosstalk",
"operateState": 1000,
"parametes": {}
},
"tts": "恩,播放相聲"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 打開電臺 |
| 2000 | 換臺 |
| 1100 | 關閉電臺 |
###### 音樂
>[info] 請求參數
~~~
{
"key": "key",
"info": "播放周杰倫的青花瓷",
"userid": "userid"
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "platform.music",
"operateState": 1000,
"parametes": {
"singer_name": "周杰倫",
"song_name": "青花瓷"
}
},
"tts": "馬上為您播放歌曲"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 開始音樂 |
| 1200 | 暫停 |
| 1400 | 停止 |
| 1300 | 繼續播放 |
| 2008 | 換一曲 |
| 2009 | 上一曲 |
| parametes內字段 | parametes字段詳解 |
| --- | --- |
| singer_name | 歌手名 |
| song_name | 歌曲名 |
###### 附近信息
>[info] 請求參數
~~~
{
"key": "key",
"info": "周圍有什么酒店",
"userid": "userid",
"location": {
"province": "北京",
"city": "北京",
"street": "信息路",
"nearest_poi_name": "上地環島南",
"latitude": "39.45492",
"longitude": "119.239293"
}
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "platform.nearby",
"operateState": 1000,
"parametes": {
"nearby_place": "酒店"
}
},
"tts": "正在查找附近酒店,請稍等"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 打開附件信息搜索 |
| parametes內字段 | parametes字段詳解 |
| --- | --- |
| nearby_place | 附近事物關鍵詞 |
###### 導航
>[info] 請求參數
~~~
{
"key": "key",
"info": "去天安門怎么走",
"userid": "userid",
"location": {
"province": "北京",
"city": "北京",
"street": "信息路",
"nearest_poi_name": "上地環島南",
"latitude": "39.45492",
"longitude": "119.239293"
}
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "platform.navigation",
"operateState": 2000,
"parametes": {
"end_city": "",
"start_place": "信息路",
"end_place": "天安門",
"start_city": "",
"needstartgeo": "1",
"needendgeo": "",
"city": "北京"
}
},
"tts": "已確定目的地天安門,正在規劃路線請稍等"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 2000 | 打開導航并確認目的地,例:導航天安門 |
| parametes內字段 | parametes字段詳解 |
| --- | --- |
| city | 當前城市 |
| end_city | 目的城市 |
| end_place | 目的地地址 |
| needendgeo | 目的地定位 |
| needstartgeo | 出發地定位 |
| start_city | 出發城市 |
| start_place | 出發地址 |
###### 天氣信息
>[info] 請求參數
~~~
{
"key": "key",
"info": "今天天氣怎么樣",
"userid": "userid",
"location": {
"province": "北京",
"city": "北京",
"street": "信息路",
"nearest_poi_name": "上地環島南",
"latitude": "39.45492",
"longitude": "119.239293"
}
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "platform.weather",
"operateState": 1000,
"parametes": {
"city": "北京",
"date": "2016-11-09",
"weather": {
"date": "周三 11月09日 (實時:6℃)",
"maxTemperature": 8,
"maxWind": 1,
"minTemperature": 2,
"temperature": "8 ~ 2℃",
"weather": "霾",
"wind": "微風"
}
}
},
"tts": "霧霾對我們身體有害!北京今天霾,微風,8到2度。"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 進入應用 |
| parametes內字段 | parametes字段詳解 |
| --- | --- |
| city | 城市 |
| date | 時間 |
| weather | 天氣信息|
###### 洗車指數
>[info] 請求參數
~~~
{
"key": "key",
"info": "今天去洗車怎么樣",
"userid": "userid",
"location": {
"province": "北京",
"city": "北京",
"street": "信息路",
"nearest_poi_name": "上地環島南",
"latitude": "39.45492",
"longitude": "119.239293"
}
}
~~~
>[success] 返回參數
~~~
{
"appState": {
"appKey": "platform.carwashing",
"operateState": 1000,
"parametes": {}
},
"tts": "洗車指數: 比較適宜 洗車后未來2天內沒有降水、大風或沙塵天氣,比較適宜洗車"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 1100 | 進入應用 |
#### 返回異常碼
~~~
{
"appState": {
"appKey": "system.error",
"operateState": 4002
},
"tts": "今天天氣怎么樣"
}
~~~
>字段說明
| operateState | operateState詳情 |
| --- | --- |
| 5000 | 暫不支持該功能 |
| 6000 | 暫不支持該功能 |
| 4000 | 請求參數格式錯誤 |
| 4002 | 無功能權限 |
| 4005 | 無功能權限|
| 4003 | 該apikey沒有可用請求次數 |
#### 附錯誤碼
(1)ret為0成功,為1失敗。
(2)apikey不對錯誤,返回結果:{"ret":1,"text":"親愛的,未找到對應的用戶信息,請稍后重試。"}
(3)加密邏輯錯誤,返回結果:{"ret":1,"text":"解密失敗,您的加密邏輯存在異常!"}
(4)userid不合法,返回結果:{"ret":1,"text":"親愛的,userid不合法。"}
(5)上傳失敗,返回結果:{"ret":1,"text":"通訊錄上傳失敗"}
(6)上傳成功,返回結果:{"ret":0,"text":"通訊錄上傳成功"}