Gmail API: Cannot create filters via Google APIs Explorer - gmail

I am trying to create filters via the Gmail API
Services > Gmail API v1 > gmail.users.settings.filters.create
Listing and lookup of single filters are working but I am not able to create new filters.
Request
POST https://www.googleapis.com/gmail/v1/users/me/settings/filters?key={YOUR_API_KEY}
{
"criteria": {
"query": "test"
},
"action": {
"addLabelIds": [
"Label_582"
]
}
}
Response
500
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
"Label_582" is valid.
Any ideas?
Thanks and best regards

Related

Google Cloud VM request is missing authentication credential

I recently deployed a Node.js/express application to a Google Cloud Compute VM. How do I send it get requests? I followed the instructions in this article to get my URL. When I curl it from the command line, though, I get a 401 authentication credential error.
Request:
https://compute.googleapis.com/compute/v1/projects/*PROJECT_ID*/zones/*ZONE*/machineTypes/e2-standard-2
I am already logged into the gcloud SDK--is there some kind of other auth I need to network with my VM?
Full Error Message:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"method": "compute.v1.MachineTypesService.Get",
"service": "compute.googleapis.com"
}
}
]
}
}

Azure REST API for running builds or pipelines

I am trying to automate the creation of Azure Pipelines for a particular branch using their REST api.
However, I am struggling to use almost all their API's, as their documentation lacks examples.
Things like List and Get are simple enough.
However, when it comes to queuing a build:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.0
POST https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=6.0
{
"parameters": <parameters>, // how do i send paramters
"definition": {
"id": 1
},
"sourceBranch": "refs/heads/feature/my-pipeline",
"sourceVersion": "d265f01aeb4e677a25725f44f20ceb3ff1d7d767"
}
I am currently struggling to send parameters.
I have tried:
Simple JSON like:
"parameters": {
"appId": "bab",
"platform": "android",
"isDemo": true
}
and stringify version of JSON like:
"parameters": "{\"appId\": \"bab\",\"platform\": \"android\",\"isDemo\": true}"
but none seems to work.
It keeps giving me the error:
{
"$id": "1",
"customProperties": {
"ValidationResults": [
{
"result": "error",
"message": "A value for the 'appId' parameter must be provided."
},
{
"result": "error",
"message": "A value for the 'platform' parameter must be provided."
},
{
"result": "error",
"message": "A value for the 'isDemo' parameter must be provided."
}
]
},
"innerException": null,
"message": "Could not queue the build because there were validation errors or warnings.",
"typeName": "Microsoft.TeamFoundation.Build.WebApi.BuildRequestValidationFailedException, Microsoft.TeamFoundation.Build2.WebApi",
"typeKey": "BuildRequestValidationFailedException",
"errorCode": 0,
"eventId": 3000
}
The docs is very unclear in how to send this data: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.1#propertiescollection
Thank you very much for you help.
I believe you cannot pass runtime parameters trough the Queue API. Instead, use Runs API
With that, your request body (use Content-type: application/json) should look something similar to this:
{
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/feature/my-pipeline"
}
}
},
"templateParameters": {
"appId": "bab"
"platform": "android"
"isDemo": true
}
}
I just realized that in the api-version=6.0 you can also send templateParameters on the Queue Service:
POST https://dev.azure.com/{organization}/{project}/_apis/build/builds?sourceBuildId={BUILD_BUILDID}&api-version=6.0
{
"templateParameters": { "doReleaseBuild": "True" },
"definition": {
"id": 1
},
"sourceBranch": "refs/heads/feature/my-pipeline",
"sourceVersion": "d265f01aeb4e677a25725f44f20ceb3ff1d7d767"
}

API 'metadata' is not supported for environment while posting to Azure Time Series Insight

Context: I am trying to post a json content to Azure Time Series Insight, through postman and getting,
{
"error": {
"code": "InvalidInput",
"message": "API 'metadata' is not supported for environment 'xxxxxxxx-1797-xxxx-82xx-639xxxx51af8'."
}
}
While making a "GET" call, I am receiving response,
{
"environments": [
{
"displayName": "perf_lab",
"environmentId": "xxxxxxxx-1797-xxxx-82xx-639xxxx51af8",
"environmentFqdn": "xxxxxxxx-1797-xxxx-82xx-639xxxx51af8.env.timeseries.azure.com",
"resourceId": "/subscriptions/xxxxxxxx-1797-xxxx-82xx-639xxxx51af8/resourcegroups/Rg01/providers/Microsoft.TimeSeriesInsights/environments/perf_lab",
"features": [
"TimeSeriesQuery",
"TimeSeriesModel",
"ColdStore",
"WarmStore"
],
"roles": [
"Reader",
"Contributor"
]
}
]
}
My payload trying for the for POST call,
{
"test_details": [
{
"project_name": "APIM"
},
{
"test_Name": "SimpleLoadTest"
},
{
"test_id": "LoadTest01"
},
{
"test_executer": "Administrator"
}
],
"response_Details": [
{
"requestName": "JSR223 Sampler",
"status": "Success",
"responseTime": 1616,
"responsecode": "200",
"sentBytes": 0,
"receivedBytes": 0,
"responseMessage": "OK",
"samplecount": 1,
"errorCount": 0,
"time": 1596682980831
}
],
"thread_Details": {
"number_vusers": 1
}
}
URL : https://xxxxxxxx-1797-xxxx-82xx-639xxxx51af8.env.timeseries.azure.com/metadata?api-version=2016-12-12
Unfortunately, /metadata endpoint is only available for Azure Time Series Insights Gen1.
If you are trying to access the /metadata endpoint of an Azure Time Series Insights Gen2 environment, it is expected to get such a response:
{
"error": {
"code": "InvalidInput",
"message": "API 'metadata' is not supported for environment 'XX'."
}
}

Sharepoint online GraphAPI create list with invalid request

I am trying to create a list with in a site using the graph API.
URL: https://graph.microsoft.com/v1.0/sites/{tenantsharepoint.com}:/sites/{siteName}:/lists
Request Body:
{
"displayName": "Books",
"columns": [
{
"name": "Author",
"text": { }
},
{
"name": "PageCount",
"number": { }
}
],
"list": {
"template": "genericList"
}
}
It was working fine but all of sudden it started giving me below exception:
{
"error": {
"code": "invalidRequest",
"message": "Provided identifier is malformed - site collection id is not valid",
"innerError": {
"date": "2020-07-31T05:28:46",
"request-id": "302c5ee3-3799-4a24-a2a3-185d7801f78a"
}
}
}
Any pointers leads would be appreciated.

Gocardless - Redirect flow in Node JS

I'm trying to use Gocardless to enable SEPA payment in my website.
The example in the API doc doesn't work and seems uncomplete
POST https://api.gocardless.com/redirect_flows HTTP/1.1
{
"redirect_flows": {
"description": "Wine boxes",
"session_token": "SESS_wSs0uGYMISxzqOBq",
"success_redirect_url": "https://example.com/pay/confirm",
"prefilled_customer": {
"given_name": "Frank",
"family_name": "Osborne",
"email": "frank.osborne#acmeplc.com"
}
}
}
That's the response I get :
{
"error": {
"message": "not found",
"errors": [
{
"reason": "not_found",
"message": "not found"
}
],
"documentation_url": "https://developer.gocardless.com/api-reference#not_found",
"type": "invalid_api_usage",
"request_id": "7ae43821-345d-4ffd-98d6-15c4fe5513e6",
"code": 404
}
}
How can it work if the access token of the application is never asked for the request ?

Resources