I try to create activity through the form 'Google+ Domains API v1' with 'plusDomains.activities.insert'
I use scopes :
https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/plus.me
https://www.googleapis.com/auth/plus.stream.write
Request is : https://www.googleapis.com/plusDomains/v1/people/me/activities?preview=true&fields=access&key={YOUR_API_KEY}
parameters :
{
"object": {
"originalContent": "Test"
},
"access": {
"items": [
{
"type": "domain"
}
],
"domainRestricted": true
}
}
but I have the following error :
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
and I have this message :
You do not have permission to execute this method.
This API call requires OAUTH2.0 authorization not an API key. That's the reason you're getting the error.
It's clearly stated in Activities.insert:
"Requires authorization"
To prove this, give the Try-it a go. It uses OAuth2. Your request should work.
Related
We are trying to get data from the google search console API with dimension types - web, discover, googleNews, news, image, video. They are all listed in the google API documentation here
But we are getting a successful response from google API only for search types 'web', 'image', and 'news', please see it below
Request URL: https://www.googleapis.com/webmasters/v3/sites/sc-domain%3Amydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "web",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 239752
========================================================================================
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "image",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 1827
====================================================================================
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "web",
"dimensionFilterGroups": [
{
"groupType": "and",
"filters": [
{
"dimension": "country",
"operator": "contains",
"expression": "GBR"
}
]
}
],
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
Queries Count: 9073
When we are making the same request with the search type 'discover' or 'googleNews' we are getting an error in the response as below
Request:
{
"startDate": "2022-06-05",
"endDate": "2022-06-22",
"dimensions": ["query","page","country"],
"type": "discover",
"dataState": "all",
"aggregationType": "byPage",
"rowLimit": 5000,
"startRow": 0
}
Response:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
We also have tried to make the API request for the full URL without sc-domain parameter as one below
https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Fwww.mydomain.com/searchAnalytics/query?fields=responseAggregationType%2Crows
But still, we are getting the same errors.
My question is - what is wrong with our requests and how to get data from the google search console API for the search types 'discover' and 'googleNews'? And is there any way to get more informative error messages from google search console API responses, that will provide a bit more explanation about the reason for the error occurred?
When testing the API at this site (https://developers.google.com/civic-information/docs/v2/elections/voterInfoQuery) I only receive a 400 response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Election unknown"
}
],
"code": 400,
"message": "Election unknown"
}
}
is this API still supported?
Yes, the API is still supported. Did you resolve the issue?
If not, make sure you're putting in a valid number for the electionId (2000 should work).
How to Add a subscription for the authenticated user's channel
https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={YOUR_API_KEY}
Request Parameters :-
{
"0":
{ "name": " <code>snippet.resourceId.kind</code>", "value": "youtube#channel" },
"1": { "name": " <code>snippet.resourceId.channelId</code>", "value": "UC_x5XG1OV2P6uZZ5FSM9Ttw" }
}
Response Parameters :-
{
"error":
{ "errors":
[ { "domain": "youtube.subscription", "reason": "publisherRequired", "message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to." } ], "code": 400, "message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to." }
}
This apears to be a bug in the Youtube api. this can be verifyed by checking the api explorer here .
POST https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={YOUR_API_KEY}
{
"0": {
"name": "snippet.resourceId",
"value": "youtube#channel"
},
"1": {
"name": "snippet.resourceId",
"value": "UC_x5XG1OV2P6uZZ5FSM9Ttw"
}
}
Response
{
"error": {
"errors": [
{
"domain": "youtube.subscription",
"reason": "publisherRequired",
"message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to."
}
],
"code": 400,
"message": "The subscription resource specified in the request must use the <code>snippet.resourceId</code> property to identify the channel that is being subscribed to."
}
}
There is an issue request for this issue and the team has been pinged.
Link of Youtube Data API (V3), you can try here
it's the image example in "try this API" of how i do
POST https://www.googleapis.com/youtube/v3/subscriptions?part=snippet HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"snippet": {
"resourceId": {
"kind": "youtube#channel",
"channelId": "UCUK0HBIBWgM2c4vsPhkYY4w"
}
}
}
i need to create and share a bucket in gcloud storage using google api's. but i got an error when am tring with postman(rest client).
Iam trying with
url
-------
https://www.googleapis.com/storage/v1/b?project=testproject
request body
------------
{
"name":"testbucketmanafnew"
}
i got an error
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
after iam created an access tocken using OAuth 2.0 Playground. And added to header
Authorization = ya29.VALUE_REDACTED
But i got error
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
what did i miss?
using Google api explorer, am able to call api's successfully
POST https://www.googleapis.com/storage/v1/b?project=testproject&key={YOUR_API_KEY}
{
"name": "testmanafcjbucketyy"
}
Authorization needs to be passed in the following format.
Authorization: Bearer [oauth2_token]
if you're using Postman the "Header" field becomes Authorization and the "Value" field becomes Bearer[WHITESPACE][oauth2_token]
https://usercontent.googleapis.com/freebase/v1/image/en/jenni_rivera
https://usercontent.googleapis.com/freebase/v1/image/en/bob_dylan
return
{
"error": {
"errors": [
{
"domain": "global",
"reason": "domainTypeForbidden",
"message": "Domain Type Forbidden"
}
],
"code": 403,
"message": "Domain Type Forbidden"
}
}
Do i do somthing wrong? API was changed?
Yes, we're looking into it. Right now the images are available from:
https://www.googleapis.com/freebase/v1/image/en/jenni_rivera
...but it should be switched back to usercontent.googleapis.com very soon.