I try to rename an object in a bucket (below named BUCKET). I obtain an access token (XXX) and use it below. But it does not work. See the transcript:
$ curl -X POST -H "Authorization: Bearer XXX" \
"https://www.googleapis.com/upload/storage/v1/b/BUCKET/o/rdf.ads/rewriteTo/b/BUCKET/o/xxx"
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badContent",
"message": "Unsupported content with type: application/octet-stream"
}
],
"code": 400,
"message": "Unsupported content with type: application/octet-stream"
}
}
I think it is a Google bug. Or why does it not work?!
You need to remove the "upload" prefix in that path (see the HTTP request documented at https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite)
Related
From Google Cloud Shell, I'm trying to call a Google API whose access scope is specified as "dataplansharing" here.
curl
-X POST
-H "Authorization: Bearer $(/home/kannanj/.local/bin/oauth2l fetch dataplansharing)"
-H "Content-Type: application/json"
-l https://mobiledataplansharing.googleapis.com/v1/operators/11344/planStatuses?userKey=Xfqom7Xm1rAJVabp0Gv7wTZ186ia37L29Cefehfu
-d '{"request": "echo"}'
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
"domain": "googleapis.com",
"metadata": {
"service": "mobiledataplansharing.googleapis.com",
"method": "google.mobile.dataplansharing.v1.MobileDataPlanSharingService.CreatePlanStatus"
}
}
]
}
}
It prompted for the grant and I accepted it. But the call fails as above. Any idea why? Note that in this usage I'm directly using the Shell, there is no Service Account impersontation involved which would be if I'm running from a VM instance. Is the method I'm trying unsupported?
I want to get a list of videos sorted by view count from all channels a CMS account manages.
So I tried query below on query on 'Try this api' page:
curl \
'https://youtube.googleapis.com/youtube/v3/search?part=snippet&forContentOwner=true&maxResults=25&onBehalfOfContentOwner=DqqiEGtVcyLMIocnDuJHoA&order=viewCount&type=video&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
And its response is:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"errors": [
{
"domain": "youtube.api.v3.SearchListResponse.Error",
"reason": "ERROR_UNSPECIFIED"
}
],
"status": "INTERNAL"
}
}
What am I missing here?
I want to get information about top keywords driving traffic to my own YouTube channel over the past 7 days. In order to do that, I followed all of the instructions. Then I generated a new access_token for my account
When I make such a request:
curl -X GET \
'https://youtubeanalytics.googleapis.com/v2/reports?dimensions=insightTrafficSourceDetail;7DayTotals&metrics=views&filters=insightTrafficSourceType==YT_SEARCH;channel==MINE&maxResults=10&sort=-views' \
-H 'Authorization: Bearer access_token'
I receive back an error:
"error": {
"code": 400,
"message": "Required",
"errors": [
{
"message": "Required",
"domain": "global",
"reason": "required"
}
]
}
}
What I do wrong when construct this kind of request?
"error": {
"code": 400,
"message": "Required",
"errors": [
{
"message": "Required",
"domain": "global",
"reason": "required"
}
]
}
Is basically a really bad error message telling that you are missing a required field.
If you check the Documentation you will notice that startdate and enddate are required fields. You have forgotten to add them to your request
Also when you get that far you separate dimensions and metrics with a , not a ;
So the problem was in query params, which I set incorrectly. Here is how the URL should be formed in order to get the data from the question:
https://youtubeanalytics.googleapis.com/v2/reports?dimensions=insightTrafficSourceDetail&metrics=views&filters=insightTrafficSourceType==YT_SEARCH&maxResults=10&sort=-views&startDate=2019-07-03&endDate=2019-07-10&ids=channel==MINE
Im calling the create conversation API https://api.botframework.com/v3/conversations using curl and getting 404 Resource not found
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"isGroup": false,
"bot": {
"id": "1247256255302317",
"name": "botname"
},
"members": [
{
"id": "969923753092546",
"name": "Users name"
}
],
"topicName": "Test topic"
}' 'https://api.botframework.com/v3/conversations'
Im also adding the Authorization header in the request. The response I get is
{ "statusCode": 404, "message": "Resource not found" }
Any idea what am I doing wrong here?
you should call with :
https://facebook.botframework.com which is serviceUrl you got from the message.
Not with 'https://api.botframework.com'.
Note : above serviceUrl is for facebook message.
Think that with each social network, there will have different serviceUrl.
I had to use https://skype.botframework.com for creating conversation for Skype bots.
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]