Can't create dialogflow agent using setagent api call

164 views
Skip to first unread message

Vic Ratnieks

unread,
Mar 30, 2022, 9:49:48 AM3/30/22
to Dialogflow Essentials Edition users
Hi,

I am getting the following error when trying to create an agent for an existing project (which was also created via the API).

POSTing to this API:

request:
{
"parent": "projects/<project_id>",
"displayName": "testagent",
"timeZone": "Australia/Melbourne",
"defaultLanguageCode": "en",
"apiVersion": "API_VERSION_V2"
}

response:
{
    "error": {
        "code": 403,
        "message": "IAM permission 'dialogflow.agents.create' on 'projects/<project_id>' denied.",
        "status": "PERMISSION_DENIED"
    }
}

and I've got the OAUTH2 access_token in the Authorization Bearer

I've googled the heck out of this and have seen others have had issues with this but can't find any resolution. I've seen discussion that the owner of the account has to have accepted the Google Terms of Service and I've done that as well.

The two API's are also enabled and they are also in the OAUTH2 scope:

I have also tried manually creating a custom role with just the permission for dialogflow.agents.create and assigned it to the user (the owner) but still get the same error.

Has anyone found a solution to this? We are meant to be able to create agents against projects, right?

Cheers, Vic

Vic Ratnieks

unread,
Mar 31, 2022, 8:26:49 AM3/31/22
to Dialogflow Essentials Edition users
This problem has been solved. I was passing projects/name instead of projects/projectId. By looking at my explanation that was impossible to tell as I was hiding it due to privacy, but I was using the project number instead of the Id! So close, but so far, I was in the forest and couldn't see the trees! Plus you don't need the parent or apiVersion in the body.

A special thanks to Google Support for spotting that for me. I highly recommend paying the USD29/month for subscription to their Standard support. The detail of their response was excellent and to the point!

Cheers, Vic

Reply all
Reply to author
Forward
0 new messages