Submit an Answer
Answers are submitted a single question at a time to the URL returned in the response object. Note that this is a URL relative to the original JSONChatStart request.
A submit request looks like:
{
"operation": "submit",
"id": <id of question>,
"value": <answer>
}
If the submitted answer does not correspond to the current question being asked, then it will be ignored. It will then return the current chat state including the current question and preceding non-question items. This also means that if there is a timeout or other network problem when performing a submit, it is safe to repeat the action as it will produce the same result.
The format of the value depends on the question being asked.
| Question | Type of value |
|---|---|
| Input with type boolean | JSON boolean |
| Input with type text | JSON string |
| Input with type number or currency | JSON number |
| Input with type date | JSON string formatted as "yyyy-mm-dd". For example, "2017-12-31". |
| Input with type datetime | JSON string formatted as "yyyy-mm-ddThh:mm:ss". For example, "2017-12-31T23:59:59". |
| Input with type time of day | JSON string formatted as "hh:mm:ss". For example, "23:59:59". |
| Input with type relationship (12.2.15 API) | JSON string or JSON array of strings where the string value has come from the value property of one of the options |
| Upload (12.2.15 API) | JSON object with fields "name" with the name of the attachment, and "data" with base64 encoded contents of the attachment. Or "false" to indicate no more uploads. If the maximum uploads for a control is reached then it will stop asking for another upload. |
| Collect | JSON boolean |
For optional input controls, passing null for the value will be interpreted as an uncertain answer.