3
votes

When I call the API intents.patch (https://dialogflow.com/docs/reference/api-v2/rest/v2/projects.agent.intents/patch) on a followup intent using the Java SDK I receive the error:

INVALID_ARGUMENT: Read-only field 'root_followup_intent_name' cannot be set.

The update request I make contains only the update of the intent training phrases (I use the update mask "training_phrases"), I'm not modifying the root followup intent.

Calling the same API on a root intent has a success response. This problem has arised only in the last few days, before it worked correctly also on followup intents.

Have you got any idea of the cause?

Thank you.

1

1 Answers

0
votes

The name attribute of the intent is a UUID defined by Dialogflow and cannot be changed (e.g. 718e3349-df8b-4d50-ac72-0de93198512a). To update a training phrase you need to use an existing training phrase ID from calls like dialogflow.projects.agent.intents.list. Here is an example of a valid dialogflow.projects.agent.intents.patch call:

PATCH https://dialogflow.googleapis.com/v2/projects/stagent-f2236/agent/intents/c757e598-c44b-485f-bcb4-01c1b0110856?intentView=INTENT_VIEW_FULL&updateMask=trainingPhrases&fields=trainingPhrases
{
 "trainingPhrases": [
  {
   "name": "718e3349-df8b-4d50-ac72-0de93198512a",
   "parts": [
    {
     "text": "updated training phrase text"
    }
   ],
   "type": "EXAMPLE"
  }
 ]
}

Here is an API explorer example for the same dialogflow.projects.agent.intents.patch call. Note you'll need to change the value of the project ID (stagent-f2236) to your Dialogflow agent's project ID, the training phrase ID (718e3349-df8b-4d50-ac72-0de93198512a) with the ID of the training phrase you'd like to change and the text (updated training phrase text) to the text you'd like to update the intent training phrase to.