Search code examples
ibm-cloudibm-watsonwatson-conversation

Api Watson : Conversation, internal error


I am trying to use the updateWorkspace function of the Conversation API of Watson but I always get this error :

{"error":"Internal Error"}

My request looks like this :

curl 
-H "Content-Type: application/json" -X POST 
-u "username":"password"
-d "{\"name\":\"Edubot\",\"dialog_nodes\":
[{\"dialog_node\":\"bonjour\",\"conditions\":\"#Bonjour\",\"output\":
{\"text\":{\"values\":[\"bonjour\"],\"selection_policy\":\"sequential\"}}},    
{\"\dialog_node\":\"Aurevoir\",\"conditions\":\"#Aurevoir\",\"output\":
{\"text\":{\"values\":[\"Au revoir\"],\"selection_policy\":\"sequential\"}}}]}" 
"https://gateway.watsonplatform.net/conversation/api/v1/workspaces/workspace_id?version=2016-09-20"

The strange thing is that if I put only one dialog node it works great, but if I add two dialog nodes or more I get the internal error.


Solution

  • When you have more than one nodes in your dialog tree, you need to specify "previous_sibling" attribute in your node definition, otherwise the dialog tree remains undefined. For example,

    {
        "dialog_nodes": [
            {
                "conditions": "#Bonjour",
                "dialog_node": "bonjour",
                "output": {
                    "text": {
                        "selection_policy": "sequential",
                        "values": [
                            "bonjour"
                        ]
                    }
                }
            },
            {
                "conditions": "#Aurevoir",
                "dialog_node": "Aurevoir",
                "output": {
                    "text": {
                        "selection_policy": "sequential",
                        "values": [
                            "Au revoir"
                        ]
                    }
                },
                "previous_sibling": "bonjour"
            }
        ]
    }