API Reference
Sample
List
Gets the list of all available samples.
Example request
curl -X GET \
https://v3-api.fpt.ai/api/v3/sample \
Example response:
[
{
"code": "0lvh6j25vvzw5bfq9ew45g0u3x8ndumc",
"app_code": "dfd6908df08cf9d825f9ca9d38bf4677",
"content": "Cho hỏi đổi cũ lấy samsung-galaxy-s9-22246 như thế nào?",
"created_time": "2018-10-03T04:16:11Z",
"intent_label": "ask_general_information",
"intent_type": 0,
"entities": [
"thu_cu_doi_moi"
]
},
{
"code": "2890odc6jatr4wxlvqv8txzk3rtkv5ip",
"app_code": "dfd6908df08cf9d825f9ca9d38bf4677",
"content": "Có phụ kiện máy samsung-galaxy-s9-22246 không?",
"created_time": "2018-10-03T04:16:11Z",
"intent_label": "ask_product",
"intent_type": 0,
"entities": [
"phu_kien"
]
},
{
"code": "3ov9x6gowo1uvwewou9xg7qhljz3ht5e",
"app_code": "dfd6908df08cf9d825f9ca9d38bf4677",
"content": "cho hỏi về dòng máy có intel-hd-graphics",
"created_time": "2018-10-03T04:16:11Z",
"intent_label": "",
"intent_type": 0,
"entities": []
}
]
Request
GET https://v3-api.fpt.ai/api/v3/sample
Parameters
Parameter | Required | Description |
---|---|---|
n/a | n/a | n/a |
Response
Returns a list of available samples.
Create
Creates new sample.
Example request
curl -X POST \
https://v3-api.fpt.ai/api/v3/sample \
-d '{
"content": "Do you have fresh checken eggs?"
}'
Example response
{
"code": "inde8872kkv40g6jga8eyszfm0dz47vz",
"app_code": "ryca8xy0bza17j0f2xiv00ljg8j8gscs",
"content": "Do you have fresh checken eggs?",
"created_time": "2018-01-11T16:00:44.025515Z"
}
HTTP Request
POST https://v3-api.fpt.ai/api/v3/sample
Parameters
Parameter | Required | Description |
---|---|---|
content | yes | content of the sample |
Response
Returns a JSON object represents the created sample.
Get
Gets an sample with the given sample code.
Example request
curl -X GET \
https://v3-api.fpt.ai/api/v3/sample/2fcli497oqfbrvte2nevm5ft962y5svp \
-H 'Authorization: Bearer your_application_token'
Example response
{
"code": "2fcli497oqfbrvte2nevm5ft962y5svp",
"app_code": "0xtqlndqkmuht0z1xcgzg0eyplz1jztk",
"content": "Sample text 1",
"created_time": "2017-10-24T13:47:17Z",
"intent": {
"intent_sample_code": "il6pc9dvz1t8px2weebep60ygczav4b2",
"intent_code": "7sdsWZJDQp",
"sample_code": "2fcli497oqfbrvte2nevm5ft962y5svp",
"intent_label": "intent_label"
},
"entities": [
{
"entity_sample_code": "7apu89e0co3hmcjai036yh695xqhsktv",
"entity_code": "vfxpyqk5v9rn49zfcxf74hdra9h6zqx8",
"sample_code": "2fcli497oqfbrvte2nevm5ft962y5svp",
"parent_code": "",
"value": "SomeValue",
"start": 2,
"end": 5,
"created_time": "",
"label": "sample_label_1",
"Type": 1
},
{
"entity_sample_code": "gudgybpeqxjokerfmrd96jxbjx5ngeae",
"entity_code": "vfxpyqk5v9rn49zfcxf74hdra9h6zqx8",
"sample_code": "2fcli497oqfbrvte2nevm5ft962y5svp",
"parent_code": "",
"value": "SomeValue",
"start": 2,
"end": 5,
"created_time": "",
"label": "sample_label_1",
"Type": 1
}
]
}
Request
GET https://v3-api.fpt.ai/api/v3/sample/:sample_code
Parameters
Parameter | Required | Description |
---|---|---|
sample_code | yes | code of the sample |
Response
Returns a JSON object that represents the sample.
Delete
Deletes an sample specified by its code.
Example request
curl -X DELETE \
https://v3-api.fpt.ai/api/v3/sample/2fcli497oqfbrvte2nevm5ft962y5svp \
-H 'Authorization: Bearer your_application_token'
Example response
{
"message": "Deleted"
}
Request
DEL https://v3-api.fpt.ai/api/v3/sample/:sample_code
Parameters
Parameter | Required | Description |
---|---|---|
sample_code | yes | code of the sample |
Response
Returns HTTP Status 200
if the request succeed.
Update
Updates an sample with the given parameters.
Example request
curl -X PUT \
https://v3-api.fpt.ai/api/v3/sample/2fcli497oqfbrvte2nevm5ft962y5svp \
-H 'Authorization: Bearer your_application_token' \
-d '{
"content": "Sample text content updated"
}'
Example response
{
"code": "2fcli497oqfbrvte2nevm5ft962y5svp",
"app_code": "0xtqlndqkmuht0z1xcgzg0eyplz1jztk",
"content": "Sample text content updated",
"created_time": "2017-10-24T13:38:59Z"
}
Request
PUT https://v3-api.fpt.ai/api/v3/sample/:sample_code
Query Parameters
Parameter | Required | Description |
---|---|---|
sample_code | yes | code of the sample |
content | yes | content of the sample |
Response
Returns a JSON object that represents the updated sample.
Intent-Sample mapping - Create
Maps an intent with a sample.
Example request
curl -X POST \
https://v3-api.fpt.ai/api/v3/intent-sample \
-d '{
"intent_code": "slyv8l0it363mh9kl922j2z8uvy9o4i1",
"sample_code": "8hal2kmfr9nj0ys323pxzjbcdxmaalra"
}'
Example response
{
"intent_sample_code": "5g69998jk1ye6o8n6k0bbhc6s9is6g5m",
"intent_code": "slyv8l0it363mh9kl922j2z8uvy9o4i1",
"sample_code": "8hal2kmfr9nj0ys323pxzjbcdxmaalra",
"intent_label": "",
"intent_type": 0,
"intent_description": ""
}
HTTP Request
POST https://v3-api.fpt.ai/api/v3/intent-sample
Parameters
Parameter | Required | Description |
---|---|---|
intent_code | yes | code of the intent |
sample_code | yes | code of the sample |
Response
Returns a JSON object represents the created intent-sample mapping.
Intent-Sample mapping - Delete
Unmap an intent from a sample by intent_sample_code.
Example request
curl -X DELETE \
https://v3-api.fpt.ai/api/v3/intent-sample/0X8pYfI0vWUR0uuVspjiaJRIQcf30e96 \
-H 'Authorization: Bearer your_application_token'
Example response
{
"message": "Deleted"
}
Request
DEL https://v3-api.fpt.ai/api/v3/intent-sample/:intent_sample_code
Parameters
Parameter | Required | Description |
---|---|---|
intent_sample_code | yes | code of the map between intent and sample |
Response
Returns a JSON object represents the result of deleting intent-sample mapping.
Intent-Sample mapping - Import
Create multiple intent-sample mappings.
Example request
curl -X POST \
https://v3-api.fpt.ai/api/v3/intent-sample/import_intent_samples \
-d '[
{
"intent": "intent_1",
"sample": "sample text 1"
},
{
"intent": "intent_2",
"sample": "sample text 2"
}
]'
Example response
{
"number_of_duplicate_sample": 0,
"number_of_empty_intent": 0,
"number_of_imported_intent": 2,
"number_of_imported_sample": 2,
"number_of_invalid_intent": 0
}
HTTP Request
POST https://v3-api.fpt.ai/api/v3/intent-sample/import_intent_samples
Parameters
Parameter | Required | Description |
---|---|---|
content | yes | list of intent-sample mappings (JSON format) |
Response
Returns a JSON object represents the created intent-sample mapping.
Entity-Sample mapping - Create
Maps an entity with a sample via tagging words and start/end position of that tagging words in the sample.
Example request
curl -X POST \
https://v3-api.fpt.ai/api/v3/entity-sample \
-d '{
"entity_code":"we2y0ceca052thxtf7jq29kk2610vjgl",
"sample_code":"8hal2kmfr9nj0ys323pxzjbcdxmaalra",
"value":"SomeValue",
"start":2,
"end":5
}'
Example response
{
"entity_sample_code": "rlrpyxl68d2gufk441na152zyby6l4ww",
"entity_code": "we2y0ceca052thxtf7jq29kk2610vjgl",
"sample_code": "8hal2kmfr9nj0ys323pxzjbcdxmaalra",
"parent_code": "",
"value": "SomeValue",
"start": 2,
"end": 5,
"created_time": "2018-10-08T03:29:02Z",
"label": "",
"Type": 0
}
HTTP Request
POST https://v3-api.fpt.ai/api/v3/entity-sample
Parameters
Parameter | Required | Description |
---|---|---|
entity_code | yes | code of the entity |
sample_code | yes | code of the sample |
value | yes | tagging words |
start | yes | star position of tagging words in the sample |
end | yes | end position of tagging words in the sample |
Response
Returns a JSON object represents the created entity-sample mapping.
Entity-Sample mapping - Delete
Unmap an entity from a sample by entity_sample_code.
Example request
curl -X DELETE \
https://v3-api.fpt.ai/api/v3/entity-sample/7apu89e0co3hmcjai036yh695xqhsktv \
-H 'Authorization: Bearer your_application_token'
Example response
{
"message": "Deleted"
}
Request
DEL https://v3-api.fpt.ai/api/v3/entity-sample/:entity_sample_code
Parameters
Parameter | Required | Description |
---|---|---|
entity_sample_code | yes | code of the map between entity and sample |
Response
Returns a JSON object represents the result of deleting entity-sample mapping.