POST /Intent
Hi Guys ! Just to get clear on the localhost:7500/documentation I was trying to add new intent to the system using ability found in "/documentation" {POST: /INTENT}
As looking at the template provided by you, I can not figure out where and how would you state "Agent Response"
Also I am not sure what I am doing wrong, can someone see the problem ?
This is the actual input that i put into the documentation in order to add new intent. (I am not sure if i am missing anything extra)
{
"agent": "Sample_Agent",
"domain": "Test",
"intentName": "TestIntent",
"useWebhook": false,
"usePostFormat": false,
"examples": [
{
"userSays": ["Hello World","Hi"
],
"entities": [
{
"entityId": 3,
"start": 2,
"end": 1,
"value": "Hey",
"entity": "Greetings",
"extractor": "string"
}
]
}
]
}
Where as the output is:
{
"statusCode": 400,
"error": "Bad Request",
"message": "The user says text is required",
"validation": {
"source": "payload",
"keys": []
}
}
Any help really appreciated. !
Thank you, Best Regards
Please look at the /intent/{id}/scenario endpoint.
Thank you for your answer !
But as I can see /intent/{id}/scenario allows me to edit already created intents. Is there a way I can create one from scratch ?
POST should create a new one. PUT should modify an existing one.
Yes I understand what do you mean.
But what I am having issue with is when im trying to use /intent/{id}/scenario it throws me problem saying the intent does not exist.
Where I know it doesn't because i want to create it.
Using POST in this example.
This is the JSON I have used:
{
"agent": "Sample_Agent",
"domain": "Test",
"intent": "Testing",
"scenarioName": "Testing",
"slots": [
{
"slotName": "string",
"entity": "TestEnt",
"isList": false,
"isRequired": false,
"textPrompts": [
"string"
]
}
],
"intentResponses": [
"Hello World"
]
}
And this is the output I get.
{
"statusCode": 400,
"error": "Bad Request",
"message": "The intent Testing doesn't exist in the domain Test"
}
Is it just me doing it wrong ?
Thanks for quick answer !
Yes, you need to create the intent first and then the scenario.
I think you are missing the point I am trying to make.
I am planning to create new INTENT using POST /intent. Which does not allow me.
POST /intent/{id}/scenario does not allow me to create intent from scratch. I wanted to create new intent, not a scenario for an intent that already exists.
So i have a step forward, I can add an intent easily now. But i had to modify the JSON code provided. I had to add two object examples Just like below.
{
"agent": "DBAgent",
"domain": "Greeting",
"intentName": "New Intent",
"useWebhook": false,
"usePostFormat": false,
"examples": [
{
**"userSays": "Hello",**
"entities": [
{
"entityId": 0,
"start": 0,
"end": 0,
"value": "string",
"entity": "string",
"extractor": "string"
}
]
},
{
**"userSays": "Hi",**
"entities": [
{
"entityId": 0,
"start": 0,
"end": 0,
"value": "string",
"entity": "string",
"extractor": "string"
}
]
}
]
}
What I mean i had to add usersays twice including the entity details. In this example i have used POST /intent Some people in future might need to know that.
Thanks
This is the same as the UI, an intent must have two examples.
I have observed that, thank you.
Kind Regards