Date comparison in azure logic app get entities connector - azure

I have a logic app , which needs to pickup records from azure table storage based on a condition where event_time (one of the field in table) >= current time +24 (hrs)
I have tried to implement above logic as
I am getting following error
{
"odata.error": {
"code": "InvalidInput",
"message": {
"lang": "en-US",
"value": "')' or operator expected at position 24 in '(event_date_time gt 2020-10-06T21:52:30.2795067Z)'.
}
}
}
Is there any way to implement above logic in azure logic app

For this problem, you can refer to my logic app below:
The expression of addToTime(...) is same with yours, and please notice there is a pair of '' on both sides of addToTime(...). And please also pay attention to the case of your field, I test with field TESTDATE in "Filter Query" but it doesn't work. So if exists upper case and lower case in your event_date_time, please use the original letter in "Filter Query".

Related

using commission junction API in CJ platform anyone using successfully?

Is anyone successfully using the CJ web services? while passing the parameters as text or xml am getting error.This is my code
Here is my code am using
This is the Params am using
and am getting the error like this...below I've mentioned
{
"statusCode": 400,
"body": "{"data":null,"errors":[{"message":"Syntax error while parsing GraphQL query. Invalid input """2", expected Value or Argument (line 1, column 71):\n{ publisherCommissions(forPublishers: [""5638564""], sincePostingDate:""2022-12-01T00:00:00Z"",beforePostingDate:""2022-12-28T00:00:00Z""){count payloadComplete records {actionTrackerName websiteName advertiserName postingDate pubCommissionAmountUsd items { quantity perItemSaleAmountPubCurrency totalCommissionPubCurrency }} }}\n ^"}]}",
}
please can someone solve this problem?
data is showing null I want to show the transaction details.

Get exception details from Azure Monitor Workbook that deals with multiple app insight instances

I am working on creating a workbook that provides an umbrella view over multiple app insight instances. Our solution has many microservices (Azure functions) each having its own app insight instance. Aim of this workbook is to provide a health status for the whole app by surfacing up errors across app insight instances in to a single view.
I have used the "Failure Analysis" template to set this up. User is able to select different app insight instances at the top and the views will filter based on that. There's a view that shows exception counts with trends like this. Each error may belong to different App Insight instances.
When you click on a line item all instances of that error will be shown in a following view like this
I use the following query to load it
let row = dynamic({Row});
let req = requests
| where '{Row}' == '{}' or (row.Kind == 'Application' and row.Id
== appName) or (row.Kind == 'Request' and row.Id ==
strcat(appName, "::", name))
| where success == "False";
let errors = exceptions
| where appName == appName
| where timestamp between({TimeRange:start}..{TimeRange:end});
errors
| join req on operation_Id
| project operation_Id, itemId, timestamp,requestName=name,
exception=type, method, outerMessage, innermostMessage,
details, appName
As mentioned in this question Get exception details from a Azure Monitor Workbook, the itemId is available and I try to link it to the "Exception Details" view. Please note that these errors can come from one of many App Insight instances based on what gets selected at the previous view.
I have configured the item Id and appName columns as follows using Link renderer and Automatic renderer.
However the link always directs to one specific app insight instance (Not the one associated with the error) and hence the error won't get loaded. Is it possible to load the "Detail Views" across App Insight instances using this technique? If not what could be other avenues?
When the application insights is workspace based, each telemetry item has a field _ResourceId that contains a link to the resource, for example
/subscriptions/c8vfbeab-a5a67-4272-aa6e-4c9f4142e962/resourcegroups/rg-my-resource-group/providers/microsoft.insights/components/my-ai-resource
You can use this a part of the url to create a deep link to the details page of the Application Insights resource of the telemetry with the specified item id. Take this query for example:
exceptions
| take 1
| extend portalUrl = strcat("https://portal.azure.com/#blade/AppInsightsExtension/BladeRedirect/BladeName/searchV1/ResourceId/", url_encode(_ResourceId), "/BladeInputs/%7B%22tables%22%3A%5B%22availabilityResults%22%2C%22requests%22%2C%22exceptions%22%2C%22pageViews%22%2C%22traces%22%2C%22customEvents%22%2C%22dependencies%22%5D%2C%22timeContextWhereClause%22%3A%22%7C%20where%20timestamp%20%3E%20datetime(%5C%222022-02-12T12%3A55%3A02.739Z%5C%22)%20and%20timestamp%20%3C%20datetime(%5C%222022-03-14T12%3A55%3A02.739Z%5C%22)%22%2C%22filterWhereClause%22%3A%22%7C%20where%20*%20has%20%5C%22a1a20ad1a12ff348a852288a4d9953a5%5C%22%7C%20order%20by%20timestamp%20desc%22%2C%22originalParams%22%3A%7B%22eventTypes%22%3A%5B%7B%22value%22%3A%22availabilityResult%22%2C%22tableName%22%3A%22availabilityResults%22%2C%22label%22%3A%22Availability%22%7D%2C%7B%22value%22%3A%22request%22%2C%22tableName%22%3A%22requests%22%2C%22label%22%3A%22Request%22%7D%2C%7B%22value%22%3A%22exception%22%2C%22tableName%22%3A%22exceptions%22%2C%22label%22%3A%22Exception%22%7D%2C%7B%22value%22%3A%22pageView%22%2C%22tableName%22%3A%22pageViews%22%2C%22label%22%3A%22Page%20View%22%7D%2C%7B%22value%22%3A%22trace%22%2C%22tableName%22%3A%22traces%22%2C%22label%22%3A%22Trace%22%7D%2C%7B%22value%22%3A%22customEvent%22%2C%22tableName%22%3A%22customEvents%22%2C%22label%22%3A%22Custom%20Event%22%7D%2C%7B%22value%22%3A%22dependency%22%2C%22tableName%22%3A%22dependencies%22%2C%22label%22%3A%22Dependency%22%7D%5D%2C%22timeContext%22%3A%7B%22durationMs%22%3A2592000000%7D%2C%22filter%22%3A%5B%5D%2C%22searchPhrase%22%3A%7B%22originalPhrase%22%3A%22", itemId,"%22%2C%22_tokens%22%3A%5B%7B%22conjunction%22%3A%22and%22%2C%22value%22%3A%22a1a20ad1a12ff348a852288a4d9953a5%22%2C%22isNot%22%3Afalse%2C%22kql%22%3A%22%20*%20has%20%5C%22a1a20ad1a12ff348a852288a4d9953a5%5C%22%22%7D%5D%7D%2C%22sort%22%3A%22desc%22%7D%7D")
| project timestamp, problemId, itemId, portalUrl
If you create a workbook and render a table based on the query above you have to modify the itemId column to be a link like this:
Clicking the itemId column it should open the correct Application Insights resource details page:
Now, I hope this give you enough clues to extend your own queries by including the deep link url in your query output.
For completeness, this is the full workbook Gallery Template:
{
"version": "Notebook/1.0",
"items": [
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "exceptions\n| take 1\n| extend portalUrl = strcat(\"https://portal.azure.com/#blade/AppInsightsExtension/BladeRedirect/BladeName/searchV1/ResourceId/\", url_encode(_ResourceId), \"/BladeInputs/%7B%22tables%22%3A%5B%22availabilityResults%22%2C%22requests%22%2C%22exceptions%22%2C%22pageViews%22%2C%22traces%22%2C%22customEvents%22%2C%22dependencies%22%5D%2C%22timeContextWhereClause%22%3A%22%7C%20where%20timestamp%20%3E%20datetime(%5C%222022-02-12T12%3A55%3A02.739Z%5C%22)%20and%20timestamp%20%3C%20datetime(%5C%222022-03-14T12%3A55%3A02.739Z%5C%22)%22%2C%22filterWhereClause%22%3A%22%7C%20where%20*%20has%20%5C%22a1a20ad1a12ff348a852288a4d9953a5%5C%22%7C%20order%20by%20timestamp%20desc%22%2C%22originalParams%22%3A%7B%22eventTypes%22%3A%5B%7B%22value%22%3A%22availabilityResult%22%2C%22tableName%22%3A%22availabilityResults%22%2C%22label%22%3A%22Availability%22%7D%2C%7B%22value%22%3A%22request%22%2C%22tableName%22%3A%22requests%22%2C%22label%22%3A%22Request%22%7D%2C%7B%22value%22%3A%22exception%22%2C%22tableName%22%3A%22exceptions%22%2C%22label%22%3A%22Exception%22%7D%2C%7B%22value%22%3A%22pageView%22%2C%22tableName%22%3A%22pageViews%22%2C%22label%22%3A%22Page%20View%22%7D%2C%7B%22value%22%3A%22trace%22%2C%22tableName%22%3A%22traces%22%2C%22label%22%3A%22Trace%22%7D%2C%7B%22value%22%3A%22customEvent%22%2C%22tableName%22%3A%22customEvents%22%2C%22label%22%3A%22Custom%20Event%22%7D%2C%7B%22value%22%3A%22dependency%22%2C%22tableName%22%3A%22dependencies%22%2C%22label%22%3A%22Dependency%22%7D%5D%2C%22timeContext%22%3A%7B%22durationMs%22%3A2592000000%7D%2C%22filter%22%3A%5B%5D%2C%22searchPhrase%22%3A%7B%22originalPhrase%22%3A%22\", itemId,\"%22%2C%22_tokens%22%3A%5B%7B%22conjunction%22%3A%22and%22%2C%22value%22%3A%22a1a20ad1a12ff348a852288a4d9953a5%22%2C%22isNot%22%3Afalse%2C%22kql%22%3A%22%20*%20has%20%5C%22a1a20ad1a12ff348a852288a4d9953a5%5C%22%22%7D%5D%7D%2C%22sort%22%3A%22desc%22%7D%7D\")\n| project timestamp, problemId, itemId, portalUrl",
"size": 1,
"timeContext": {
"durationMs": 86400000
},
"queryType": 0,
"resourceType": "microsoft.insights/components",
"gridSettings": {
"formatters": [
{
"columnMatch": "problemId",
"formatter": 1,
"formatOptions": {
"linkColumn": "portalUrl",
"linkTarget": "Url"
}
}
]
}
},
"name": "query - 2"
}
],
"fallbackResourceIds": [
"/subscriptions/4547474-1a67-4272-aa6e-4c9f4142e269/resourceGroups/rg-resourcegroup-prod/providers/microsoft.insights/components/appi-demo-prod"
],
"$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json"
}
It looks like from a quick perusal of the code, that if you also have an appName column in the row where itemId is, it will try to look in the resource list used in the query to try to find a resource with that same name, and if not, just take the first one it can find?
but i see that you have appName there, but i'm not sure the rest of the configuration from your step? are you also using all of the resources in the query?

What is the query format for Terraform New Relic Workload resource

What is the query format for Terraform New Relic Workload resource? I have the below resource specified in my main.tf file and I want to be able to get all the entities that have a specific label.
...
resource "newrelic_workload" "prod-app" {
name = "Prod App"
account_id = <account id>
entity_search_query {
query = "label.STAGE = prod"
}
}
However, it seems to throw this error:
Error: A downstream error occurred., [{"extensions":{},"message":"Search query \u003clabel.STAGE = 'prod'\u003e is invalid, response message is \u003cProvided filter: label.STAGE = 'prod' is not a valid NRQL query (You can't use field: label.STAGE, that is not defined in schema.)\u003e"}]
There doesn't seem to be much info on the documentation other that it needs to be a valid NRQL query. The example seems to use "name like 'Example application'"
https://registry.terraform.io/providers/newrelic/newrelic/latest/docs/resources/workload
Ok, I figured it out. Turns out that I was just referring to a key that doesn't exist.
It should be tags.<tag key> so tags.label.STAGE.
I noticed my mistake when I looked at the API behind the scenes. It uses the NerdGraph API and the Query entities section describes how to structure your query.

How to get PaymentIntent next_action.type = redirect_to_url instead of use_stripe_sdk for Subscription

I am working on the implementing Subscription*(which is SCA ready) using Stripe.
I try to handle https://stripe.com/docs/billing/subscriptions/payment#handling-action-required.
After the subscription is created on Stripe side, I have got the answer like in documentation above:
{
"id": "sub_XXXXXXXXXXXXXXXXXXX",
"object": "subscription",
"status": "incomplete",
...
"latest_invoice": {
...
"payment_intent": {
"status": "requires_action",
...
"next_action": {
"type": "use_stripe_sdk",
...
},
...
}
}
}
According to the documentation https://stripe.com/docs/api/payment_intents/object#payment_intent_object-next_action-type
next_action.type can have two values redirect_to_url and use_stripe_sdk
So my question is how to get next_action.type = redirect_to_url(instead of use_stripe_sdk) and how to force stripe to fill next_action.redirect_to_url(Because I want to handle it on my own in my UI)?
*There is already a similar question on SO:
https://stackoverflow.com/questions/56490033/how-to-handle-use-stripe-sdk-through-php
but my case is to create Subscription where I don't have control over PaymentIntent
In my understanding, the next_action.type will be equal to redirect_to_url only if you choose to manually handle 3D Secure authentication https://stripe.com/docs/payments/payment-intents/verifying-status#manual-3ds-auth
As per documentation:
To handle 3D Secure authentication manually, you can redirect the customer. This approach is used when you manually confirm the PaymentIntent and provide a return_url destination to indicate where the customer should be sent once authentication is complete. Manual PaymentIntent confirmation can be performed on the server or on the client with Stripe.js.
Example using Stripe.js:
stripe.confirmPaymentIntent(
'{PAYMENT_INTENT_CLIENT_SECRET}',
{
payment_method: '{PAYMENT_METHOD_ID}',
return_url: 'https://example.com/return_url'
}
).then(function(result) {
// Handle result.error or result.paymentIntent
});
Example using Stripe Python:
intent = stripe.PaymentIntent.confirm(
'{PAYMENT_INTENT_ID}',
payment_method='{PAYMENT_METHOD_ID}',
return_url='https://example.com/return_url'
)
EDIT: as per #karllekko's comment the {PAYMENT_INTENT_ID} will in your case be latest_invoice.payment_intent.id.
Please read https://stripe.com/docs/payments/3d-secure-iframe - it gives more details about the "return_url" flow - and describes also posibilities to customize it inside "iframe" etc
Probably this document is fairly recent - so at the time of this question (July) it was not existing yet

Odata $filter for the date in the Office 365 REST API

I'm trying to retrieve events for a user from its Office 365 account using the REST API but filtered by the field "Start". For instance, retrieve all the events that will happen after the date: 2014-08-29T09:13:28' but i'm always retrieving this error message
{
"error": {
"code": "ErrorInvalidUrlQuery",
"message": "The query parameter '$filter' is invalid.",
"innererror": {
"message": "The query parameter '$filter' is invalid.",
"type": "Microsoft.Exchange.Services.OData.InvalidUrlQueryException",
"stacktrace": " at Microsoft.Exchange.Services.OData.Web.ODataQueryOptions.Populate()
at Microsoft.Exchange.Services.OData.ODataContext..ctor(HttpContext httpContext, Uri requestUri, ServiceModel serviceModel, ODataPathWrapper odataPath, ODataUriParser odataUriParser)
at Microsoft.Exchange.Services.OData.Web.RequestBroker.InitializeODataContext()
at Microsoft.Exchange.Services.OData.Web.RequestBroker.Process()",
"internalexception": {
"message": "A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.Int32' for operator kind 'Equal'.",
"type": "Microsoft.OData.Core.ODataException",
"stacktrace": " at Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.PromoteOperandTypes(BinaryOperatorKind binaryOperatorKind, SingleValueNode& left, SingleValueNode& right)
at Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)
at Microsoft.OData.Core.UriParser.Parsers.MetadataBinder.Bind(QueryToken token)
at Microsoft.OData.Core.UriParser.Parsers.FilterBinder.BindFilter(QueryToken filter)
at Microsoft.OData.Core.UriParser.ODataUriParser.ParseFilterImplementation(String filter, IEdmType elementType, IEdmNavigationSource navigationSource)
at Microsoft.OData.Core.UriParser.ODataUriParser.ParseFilter()
at Microsoft.Exchange.Services.OData.Web.ODataQueryOptions.Populate()"
}
}
}
}
Here all the thing i've tried:
[ressource]=https://outlook.office365.com/
url: [ressource]EWS/OData/Me/Events?$filter=Start%20eq%20DateTime'2012-05-29T09:13:28'
url: [ressource]EWS/OData/Me/Events?$filter=Start%20eq%20DateTime'20141231'
url: [ressource]EWS/OData/Me/Events?$filter=month(Start)%20eq%2012
And i've tried the $filter on string field or the $select on the field Start and it worked perfectly so i think my error is caused by the date format but i don't know how to solve it, so if anybody could help me on that, it woud be great!
Thank you!
Filtering on dates does work, but you can't do everything in the OData v4 spec. For example, these all work for me:
/Me/Events?$filter=Start eq 2014-08-28T21:00:00Z
/Me/Events?$filter=Start ge 2014-08-28T21:00:00Z
Adding the "DateTime" in front of it makes it fail. The same with the month function. If you stick with the format above it should work for you.
In V2 of the O365 REST API you should use:
URL encoded: $filter=Start/DateTime%20ge%20%272017-03-15T00:00:00Z%27
Not URL encoded: $filter=Start/DateTime ge '2017-03-15T00:00:00Z'
More info https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar#filter-requests
Hi Just increase top=100 or more whatever you want to pull from your inbox.
https://outlook.office365.com/api/v2.0/me/MailFolders/Inbox/messages/?%24select=CreatedDateTime%2cLastModifiedDateTime%2cChangeKey%2cCategories%2cReceivedDateTime%2cSentDateTime%2cHasAttachments%2cSubject%2cBody%2cImportance%2cParentFolderId%2cSender%2cFrom%2cToRecipients%2cCcRecipients%2cBccRecipients%2cReplyTo%2cConversationId%2cIsDeliveryReceiptRequested%2cIsReadReceiptRequested%2cIsRead%2cIsDraft%2cWebLink&%24top=100&%24skip=0"

Resources