API
TypeTravel Chat API
This is a chat bot API that offers access to TypeTravel natural language processing. An application using this API allows users to interact
via a chat discussion to define common travel parameters such as number of travelers, place names and locations, and fuzzy date ranges.
Applications or Travel websites can use this Chat API to use these parsed information elements to search their system for matching flights, hotels, or travel packages.
1. Create Chat Session
Endpoint: http://www.typetravel.com/api/chat
Method: POST
Request: none
Request format: none
Response: chat session id
Response format: string
Sample Request:
curl -X POST \
http://www.typetravel.com/api/chat \
-H 'cache-control: no-cache' \
-H 'content-type: application/json'
Sample Response:
"636797013597946519-186a275b-e5aa-45a9-ae07-fb3d14419f02"
2. Put message
Endpoint:
http://www.typetravel.com/api/chat/[chat session id]
Method: PUT
Request: message text
Request format: application/json
Response: list of messages and a travel query response object
Response format:
json object
Sample Request:
curl -X PUT \
http://www.typetravel.com/api/chat/636797013597946519-186a275b-e5aa-45a9-ae07-fb3d14419f02
-H 'cache-control: no-cache' \
-H 'content-type: application/json'
Sample Response:
{
"SessionId": "636797010807216898-507efb16-43d9-4146-8dc3-758224881a43",
"dtmStart": "2018-12-06T13:51:20",
"lcm": [
{
"message": "Hi, I am your Cyber Travel Agent, how can I help you ?",
"id": "636797010807226899-cf49a782-266c-4b3b-a58a-4793624a2d00",
"parentId": "",
"dtm": "2018-12-06T13:51:20",
"qi": 0,
"user": false
},
{
"message": "book hotels",
"id": "636797010956535439-32cfaf0d-0edb-42c4-8203-d91ad92252ef",
"parentId": "636797010807226899-cf49a782-266c-4b3b-a58a-4793624a2d00",
"dtm": "2018-12-06T13:51:35.6535439-08:00",
"qi": 0,
"user": true
},
{
"message": "When do you plan to start your trip ?",
"id": "636797010956535439-6f0264a7-d60b-4a5e-abfa-f5582225f69d",
"parentId": null,
"dtm": "2018-12-06T13:51:35.6535439-08:00",
"qi": 1,
"user": false
}
],
"lqiPending": [],
"tqr": {
"hasCheckInDate": false,
"hasCheckOutDate": false,
"checkInDate": null,
"checkOutDate": null,
"hasDepartureLocation": false,
"hasDestinationLocation": false,
"departureLocation": null,
"destinationLocation": null,
"personCount": 0,
"adultCountExists": false,
"adultCount": 0,
"childCountExists": false,
"childCount": 0,
"childAgeExists": false,
"childAges": null,
"currencyCode": null
}
}
3. Get messages
Endpoint:
http://www.typetravel.com/api/chat/[chat session id]
Method: GET
Request: none
Request format: none
Response: list of messages and a travel query response object
Response format:
json object
Sample Request:
curl -X GET \
http://www.typetravel.com/api/chat/636797013597946519-186a275b-e5aa-45a9-ae07-fb3d14419f02 \
-H 'cache-control: no-cache' \
-H 'content-type: application/json
Sample Response:
"SessionId": "636797010807216898-507efb16-43d9-4146-8dc3-758224881a43",
"dtmStart": "2018-12-06T13:51:20",
"lcm": [
{
"message": "Hi, I am your Cyber Travel Agent, how can I help you ?",
"id": "636797010807226899-cf49a782-266c-4b3b-a58a-4793624a2d00",
"parentId": "",
"dtm": "2018-12-06T13:51:20",
"qi": 0,
"user": false
},
{
"message": "book hotels",
"id": "636797010956535439-32cfaf0d-0edb-42c4-8203-d91ad92252ef",
"parentId": "636797010807226899-cf49a782-266c-4b3b-a58a-4793624a2d00",
"dtm": "2018-12-06T13:51:35.6535439-08:00",
"qi": 0,
"user": true
},
{
"message": "When do you plan to start your trip ?",
"id": "636797010956535439-6f0264a7-d60b-4a5e-abfa-f5582225f69d",
"parentId": null,
"dtm": "2018-12-06T13:51:35.6535439-08:00",
"qi": 1,
"user": false
}
],
"lqiPending": [],
"tqr": {
"hasCheckInDate": false,
"hasCheckOutDate": false,
"checkInDate": null,
"checkOutDate": null,
"hasDepartureLocation": false,
"hasDestinationLocation": false,
"departureLocation": null,
"destinationLocation": null,
"personCount": 0,
"adultCountExists": false,
"adultCount": 0,
"childCountExists": false,
"childCount": 0,
"childAgeExists": false,
"childAges": null,
"currencyCode": null
}
}