I need to use Gmail Postmaster Tools API, but in google documentation I don't find it that useful. I am facing issue in finding out which API key to use and what credentials to create, like Service Account or OAuth 2. I want to test it locally. Here is the curl command I am using:
curl 'https://gmailpostmastertools.googleapis.com/v1beta1/domains/www.example.com/trafficStats/20200705?access_token=[ACCESS_TOKEN]' --header 'Accept: application/json' --compressed
Response:
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
Well it turns out that my domain was not verified with my google account. When I added DNS record than it started working.