History API¶
History APIは、APIキーに該当するエージェントの会話履歴を返却します。
Endpoint: https://api.obotai.com/agent/history?params[]
Method: GET
リクエスト¶
Header:
X-Api-Key: (CMSで発行したAPIキー)
params:
以下は全てオプションとなります。
start_time: 取得する会話履歴の開始時間( 例: 2019-07-03, 2019-07-03T00:00:00 )
end_time: 取得する会話履歴の終了時間( 例: 2019-07-03, 2019-07-03T23:59:59 )
limit: 取得する会話履歴の最大件数(1~1000)
session_id: セッションIDに該当する会話履歴のみ取得
language_code: 言語コードに該当する会話履歴のみ取得
ordering: データのソート順(値はinsert_date_time, -insert_date_timeのみ設定可能)
レスポンス¶
レスポンスデータ(JSON)¶
[
{
session-id: '...',
insert_date_time: 'yyyy-mm-dd HH:MM:ss',
response_json: {
responseId: "...",
queryResult: {
queryText: "質問内容",
...
"fulfillmentMessages": [
response_data, ...
]
}
...
language_code: "言語"
}
}
]
回答内容 response_data
は当質問文に対し、すべてのプラットフォームでの回答内容となります。
AIエンジンの障害等でレスポンスを返却できなかった場合、queryResult
の次の項目は空になる場合があります。
queryResult.queryText
queryResult.action
queryResult.fulfillmentText
queryResult.fulfillmentMessages
queryResult.webhookSource
queryResult.webhookPayload
queryResult.outputContexts
queryResult.intent
queryResult.intentDetectionConfidence
利用例¶
curl:
curl \
-X GET \
-H 'X-Api-Key: 00000000-0000-0000-0000-000000000000' \
'https://api.obotai.com/agent/history?limit=100&start_time=2019-07-02&end_time=2019-07-03&language_code=ja'
python:
import requests
import pprint
url = 'https://api.obotai.com/agent/history?limit=10&start_time=2019-07-02&end_time=2019-07-03&language_code=ja'
res = requests.get(
url,
headers={
'X-Api-Key': "00000000-0000-0000-0000-000000000000",
}
)
pprint.pprint(res.json())