API Reference
Entity
List
Gets the list of all available entities for the application.
Example request
curl -X GET \
https://v3-api.fpt.ai/api/v3/entity \
-H 'Authorization: Bearer your_application_token'
Example response
[
{
"code": "7j0lqsf2phw10oik1vkckl0dlf1k9msz",
"app_code": "ryca8xy0bza17j0f2xiv00ljg8j8gscs",
"label": "qty",
"type": 1,
"description": "Quantity",
"created_time": "2018-01-11T09:22:40Z"
},
{
"code": "qj9rbjqjazy8w73fr1h2q71zqct6dsz8",
"app_code": "ryca8xy0bza17j0f2xiv00ljg8j8gscs",
"label": "product_name",
"type": 1,
"description": "Product name",
"created_time": "2018-01-11T09:18:31Z"
}
]
Request
GET https://v3-api.fpt.ai/api/v3/entity
Parameters
Parameter | Required | Description |
---|---|---|
n/a | n/a | n/a |
Response
Returns a list of available entities for the application.
Create
Creates a new entity with the given parameters.
Example request
curl -X POST \
https://v3-api.fpt.ai/api/v3/entity \
-H 'Authorization: Bearer your_application_token'
-d '{
"label":"product_name",
"description":"Product name",
"type": 1
}'
Example response
{
"code": "qj9rbjqjazy8w73fr1h2q71zqct6dsz8",
"app_code": "ryca8xy0bza17j0f2xiv00ljg8j8gscs",
"label": "product_name",
"type": 1,
"description": "Product name",
"created_time": "2018-01-11T16:18:31.1608251+07:00"
}
HTTP Request
POST https://v3-api.fpt.ai/api/v3/entity
Parameters
Parameter | Required | Description |
---|---|---|
label | yes | name of the entity, must use a-z0-9_ |
description | yes | description of the entity |
type | yes | type of the entity, value: 1: keyword & freetext; 2: keyword; 3: freetext |
Response
Returns a JSON object represents the created entity.
Get
Gets an entity with the given name.
Example request
curl -X GET \
https://v3-api.fpt.ai/api/v3/entity/product_name \
-H 'Authorization: Bearer your_application_token'
Example response
{
"code": "qj9rbjqjazy8w73fr1h2q71zqct6dsz8",
"app_code": "ryca8xy0bza17j0f2xiv00ljg8j8gscs",
"label": "product_name",
"type": 1,
"description": "Product name",
"created_time": "2018-01-11T09:18:31Z"
}
HTTP Request
GET https://v3-api.fpt.ai/api/v3/entity/:label
Parameters
Parameter | Required | Description |
---|---|---|
label | yes | name of the entity |
Response
Returns a JSON object that represents the intent.
Delete
Deletes an entity specified by name.
Example request
curl -X DELETE \
https://v3-api.fpt.ai/api/v3/entity/product_name \
-H 'Authorization: Bearer your_application_token'
Example response
HTTP 200 OK
HTTP Request
DEL https://v3-api.fpt.ai/api/v3/entity/:label
Parameters
Parameter | Required | Description |
---|---|---|
label | yes | name of the entity |
Response
Returns HTTP Status 200
if the request succeed.
Update
Updates an entity specified by its name with the given parameters. You can update the description only.
Example request
curl -X PUT \
https://v3-api.fpt.ai/api/v3/entity/product_name \
-H 'Authorization: Bearer your_application_token'
-d {
"description":"New Description",
"type":1
}
Example response
{
"code": "qj9rbjqjazy8w73fr1h2q71zqct6dsz8",
"app_code": "ryca8xy0bza17j0f2xiv00ljg8j8gscs",
"label": "product_name",
"type": 1,
"description": "New Description",
"created_time": "2018-01-11T09:18:31Z"
}
Request
PUT https://v3-api.fpt.ai/api/v3/entity/:label
Parameters
Parameter | Required | Description |
---|---|---|
description | yes | new description of the entity |
type | yes | type of the entity, value: 1: keyword & freetext; 2: keyword; 3: freetext |
Response
Returns a JSON object that represents the updated entity.
Get all samples of entity
List all samples of entity.
Example request
curl -X GET \
https://v3-api.fpt.ai/api/v3/entity/{lable}/samples \
-H 'Authorization: Bearer your_application_token'
Example response
[
{
"code": "alpqyg5bnzqsl2p8ftnp6ufesa9ocigj",
"app_code": "dfd6908df08cf9d825f9ca9d38bf4677",
"content": "Thẻ nhớ ngoài hỗ trợ bao nhiêu GB?",
"created_time": "2018-10-03T04:16:07Z",
"intent_label": "ask_attribute",
"intent_type": 0,
"entities": [
"the_nho_ngoai"
]
},
{
"code": "d1ujxrmhebjv59mxbxsepr64pd3pxm49",
"app_code": "dfd6908df08cf9d825f9ca9d38bf4677",
"content": "Redmi note 5 có hỗ trợ thẻ nhớ không",
"created_time": "2018-10-03T04:16:07Z",
"intent_label": "ask_attribute_y_n",
"intent_type": 0,
"entities": [
"the_nho_ngoai"
]
}
]
Request
PUT https://v3-api.fpt.ai/api/v3/entity/{label}/samples
Parameters
Parameter | Required | Description |
---|---|---|
label | yes | The label of the entity |
Response
Returns the list of samples of entity.
Delete all samples of entity
Delete all samples of entity.
Example request
curl -X DELETE \
https://v3-api.fpt.ai/api/v3/entity/{label}/samples \
-H 'Authorization: Bearer your_application_token'
Example response
{
"message": "Deleted"
}
Request
DELETE https://v3-api.fpt.ai/api/v3/entity/{label}/samples
Parameters
Parameter | Required | Description |
---|---|---|
label | yes | The label of entity |
Response
Returns a message of status of delete request.