I'm studying about Google Cloud Platform.
In this stackdriver projects.groups.members.list I'm trying to get member's list in stackdriver's group.
when I command this code in above link,I get this error.
GET https://monitoring.googleapis.com/v3/projects/{my_project}/groups/{my_group}/members?key={YOUR_API_KEY}
error :
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
my_project and my_group is correct, and there is no other argument, is there any problem?
I found that {my_group} is not alphabetical string like my_group,
but integer string like 12345678956.
in this projects.groups.list you can find your group_id by excuting APIs Explorer.
Related
I am trying to move resources from one resource group to another via Postman.
I got the access token successfully by using below parameters:
https://login.microsoftonline.com/mytenantid/oauth2/v2.0/token
client_id='myclientid'
&scope=https://management.azure.com/.default
&grant_type=client_credentials
&client_secret='appclientsecret'
I am using query like below:
POST
https://management.azure.com/subscriptions/mysubscriptionid/resourceGroups/resourcegroupname/moveResources?api-version=2021-04-01
Request Body
{
"resources" : "/subscriptions/mysubscriptionid/resourceGroups/resourcegroupname/providers/Microsoft.KeyVault/vaults/keyvaultname",
"targetResourceGroup" : "/subscriptions/mysubscriptionid/resourceGroups/targetresourcegroupname"
}
But I got error like below:
{ "error": { "code": "UnsupportedMediaType",
"message": "The content
media type 'text/plain' is not supported. Only 'application/json' is
supported."
} }
After changing the type to JSON, I am getting another error like below:
{ "error": { "code": "InvalidRequestContent", "message": "The request
content was invalid and could not be deserialized: 'Error converting
value
"/subscriptions/mysubscriptionid/resourceGroups/resourcegroupname/providers/Microsoft.KeyVault/vaults/keyvaultname"
to type 'System.String[]'. Path 'resources', line 2, position 143.'."
} }
Can anyone help me to resolve this error?
I tried to reproduce the same in my environment and was able to move resources successfully like below:
Make sure your request body is something like below:
{
"resources" : ["/subscriptions/XXXXXXX/resourceGroups/Test/providers/Microsoft.KeyVault/vaults/testkeyvault549","/subscriptions/XXXXXXXXX/resourceGroups/Test/providers/Microsoft.Storage/storageAccounts/sristackdem01"],
"targetResourceGroup" : "/subscriptions/XXXXXXX/resourceGroups/Demo"
}
When I executed the same query, I got below response:
Please note that resources parameter expects list of resource IDs in [ ]. So, make sure to add them.
When I missed giving [ ] as mentioned above, I got the same error as you like below:
Reference:
Validate Azure Resource Move with Postman - Apostolidis Cloud Corner
I'm attempting to update an existing sink using the (Python) Google Stackdriver Logging API, and am getting an error that I can't track down.
The API explorer for the method in question is here, to which I'm supplying projects/my_project/sinks/my_sink_name as the sinkName, and the following for the Request Body:
{
"name": "audit_logs",
"destination": "bigquery.googleapis.com/projects/my_project/datasets/destination_dataset",
"filter": "resource.type=\"bigquery_resource\""
}
When submitting, I get the following error:
400 Bad Request
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
...which doesn't specify which argument is invalid, and I have tried several variations without any success.
Additional info: this request is based on one generated by the Python API. I have also tried specifying the full path of the sink in name to no avail, which is what the Python API generates, which seems contrary to the documentation.
Can you try the UpdateSink with uniqueWriterIdentity set to true?
From https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update:
"It is an error if the old value is true and the new value is set to false or defaulted to false."
I'm trying to get insights for all the posts from one of my facebook pages. I tried out the expression below in graph explorer but i got an error. I managed to get insights for just one post using its id, but it doesn't seem to work when I want to get all the posts at once.
{page-id}/posts/?fields=insights{post_impressions_unique}
{
"error": {
"message": "Invalid query",
"type": "OAuthException",
"code": 3001,
"error_subcode": 1504028,
"is_transient": false,
"error_user_title": "No Metric Specified",
"error_user_msg": "No metric was specified to be fetched. Please specify one or more metrics to be fetched and try again.",
"fbtrace_id": "Ao79E5/rtfn"
}
}
Any ideas?
The /object-id/insights/metricname syntax does not translate into foo{bar} like other sub-fields, you need to use a slightly different syntax here:
?fields=insights.metric(post_impressions_unique)
When i use GET /v2.4/{photo-id} in graph API explorer
It throws an error :
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: {user-id}",
"type": "OAuthException",
"code": 803
}
}
what does this really mean ? any help
You seem to be passing {user-id} which is not a valid data to query about.
Instead, use the below code without {user-id}:
GET /v2.4/{photo_id}
{photo_id} is an id of a post most probably in the userid_postid ("10000_00001") format.
How can I convert from Facebook's Graph API Explorer to a valid URL? I'm trying to combine these elements:
GET method
https://graph.facebook.com/1261653562?fields=id,name,albums.fields(photos.fields(picture,name),updated_time)
Access_token=AAAC....
I tried this:
https://graph.facebook.com/1261653562?method=GET&fields=id,name,albums.fields(photos.fields(picture,name),updated_time)?access_token=AAAC.....
but this returns me this error:
{
"error": {
"message": "Syntax error \"Expected end of string instead of \"a\".\" at character 63: id,name,albums.fields(photos.fields(picture,name),updated_time)access_token=AAACEdEose.........",
"type": "OAuthException",
"code": 2500
}
}
Thanks!
change "?" before access_token to "&"
https://graph.facebook.com/1261653562?method=GET&fields=id,name,albums.fields(photos.fields(picture,name),updated_time)?access_token=AAAC
like this:
https://graph.facebook.com/1261653562?method=GET&fields=id,name,albums.fields(photos.fields(picture,name),updated_time)&access_token=AAAC