I'm trying to create and query a fusion table. So what I did:
I created a new fusion table in google drive
Created a new api key
Set the fusion table to public (using share button)
Now I'm using Advanced REST client executing this request:
GET https://www.googleapis.com/fusiontables/v2/tables?key=[myapikey]
But I keep getting 401: Unauthorized
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
The docs say that this should work, but I keep getting this message. Any hint?
p.s.: The reason why I use an api key only is simply because I created a batch which sends the request, the data is public and there is no user authentication required.
Related
I am using Google Drive API (v2) and used to make successful patch requests as explained here:
https://developers.google.com/drive/v2/reference/properties/patch
in order to add a new metadata property (myNewPr) into my documents.
However, recently (maybe 1-2 days) I started to receive 404 error messages:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Property not found: key = myNewPr and visibility = PRIVATE",
"locationType": "other",
"location": "property"
}
],
"code": 404,
"message": "Property not found: key = myNewPr and visibility = PRIVATE"
}
}
Any ideas ? When I am testing by using insert (https://developers.google.com/drive/v2/reference/properties/insert) it seems to work.
I'm using the API Explorer tool to create some request urls for google adsense. Here is the request url that the explorer tool generated that gives a response of today's earnings: https://www.googleapis.com/adsense/v1.4/reports?startDate=today&endDate=today&accountId=MY_ACCOUNT_ID&metric=EARNINGS&key=MY_API_KEY
However, when I try to use this url in the browser or in my code it gives this response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
I am not sure what I am missing it use this url. I have activated adsense apis on my google developer console.
The key parameter is the public API key for accessing public data.
The access_token parameter is used for accessing private user data.
In your case you are trying to access your private account and should be using an access token.
To obtain an access token you need to authentication your application using either Oauth2 or a service account. Once you have obtained an access token and send that with your request as so:
https://www.googleapis.com/adsense/v1.4/reports?startDate=today&endDate=today&accountId=MY_ACCOUNT_ID&metric=EARNINGS&access_token=YourAccessToken
You need to replace MY_API_KEY with your API key, and MY_ACCOUNT_ID in same fashion.
I'm trying to make a call to Google Reports API with a service account.
I follow this code example : https://godoc.org/golang.org/x/oauth2/google#JWTConfigFromJSON
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Access denied. You are not authorized to read activity records."
,
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Access denied. You are not authorized to read activity records."
}
}
I'm pretty sure it is on Google configuration side but :
I created the service account
I downloaded the JWT
I authorized the needed scopes
Then I try to call this URL : https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/login
What could I have forget ?
Thanks for helping me.
Fixed it. Needed to explicitly specify the subject value.
I now follow the Service Account example : https://godoc.org/golang.org/x/oauth2/google
I'm trying to access calendar details but I seem to get a invalid credentials error.
I access the following url: "https://www.googleapis.com/calendar/v3/calendars/{google_id}/events"
like this :
DefaultHttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url_);
get.addHeader("Authorization","OAuth" + auth_token);
try {
HttpResponse response = client.execute(get);
What extra headers should I put there? I'm accessing it from an android application. If it matters I got my auth_token by an activity started with AccountManager.newChooseAccountIntent().
I'm getting the following json:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
There should be a space between OAuth and the token in your header.
Hi am trying to build an app to standardized signatures of all users in my google domain.
For that I have tried with following Google APIs in apis explorer
https://developers.google.com/apis-explorer/?hl=en_US#p/gmail/v1/gmail.users.settings.sendAs.patch
and pass other user's Id and email with custom signature but it's giving me following error
REQUEST
<pre>
PATCH https://www.googleapis.com/gmail/v1/users/[21_DIGIT_USER_ID]/settings/sendAs/[SOME_OTHER_USER#DOMAIN.COM]?fields=signature&key={YOUR_API_KEY}
{
"signature": "my custom signature"
}
</pre>
RESPONSE
<pre>
403 Forbidden
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Delegation denied for myemailid#mydomain.com"
}
],
"code": 403,
"message": "Delegation denied for myemailid#mydomain.com"
}
}
</pre>
Although I have delegated admin access and I am able to change my user's signature by passing me in userId field and email id in sendAsEmail.
What's the use of userId field if an delegated admin can't change other user's signature.