Hi Google Team,
I am able to execute the below Google Analytics API in the Google Analytics-->Reporting--> Reporting APIv4
curl --request POST \
'https://analyticsreporting.googleapis.com/v4/reports:batchGet?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"reportRequests":[{"viewId":"134778649","dateRanges":[{"endDate":"2023-11-30","startDate":"2010-11-01"}],"metrics":[{"expression":"ga:pageviews"}],"dimensions":[{"name":"ga:userAgeBracket"}]}]}' \
--compressed
But I am not able to get the same response from postman, I get the below error:
I would suggest ensuring that your OAuth 2.0 credentials have the necessary scope permissions to access the Google Analytics API. It's possible that your credentials are missing the required scope for this specific API.
To resolve this, here are a few steps you can take:
Double-Check Credentials: Make sure that you've correctly configured the OAuth 2.0 credentials in Postman. Ensure that you have the correct client ID, client secret, and have set up the appropriate OAuth 2.0 flow.
Token Expiry: OAuth 2.0 access tokens have an expiration time. Check if your access token is still valid. If it has expired, you'll need to obtain a new one by going through the OAuth 2.0 authentication process again.
It you seek information or resources related to Google Analytics or API integrations, check out DataHive360. They might provide valuable guides or articles to assist you in setting up your API requests successfully.