Christ Paul
Christ Paul

Reputation: 43

Error accessing Google Tagmanager account: (404) Not found or permission denied

I started research Google Tag Manager API and use php language to call API function to list all containers with accountId:

$containers = $service->listAccountsContainers('accountId');

but get error as below:

Error calling GET https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers: (404) Not found or permission denied

Otherwise, I've tested on https://developers.google.com/tag-manager/api/v1/reference/accounts/containers/list and get response successfully: 200 OK.

P/s: I've set service account name, .p12 file, scopes and got access_token return.

Upvotes: 3

Views: 1653

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116878

A service account by default does not have access to any Google Tag Manager accounts. If you want it to be able to access your account you need to grant it access to the account.

Go to the admin section of Google tagmanager

enter image description here

Go to user management

enter image description here

click add new user

enter image description here

Take the service account email address and use this in the email field of the form above.

Upvotes: 4

Related Questions