eBay Digital Signatures for APIs Signature header error 215114 The create time of signature parameters is not in right range - digital-signature

I am trying to test Digital Signatures for APIs and I'm having trouble with the signature header (https://developer.ebay.com/develop/guides/digital-signatures-for-apis#sig). In this example, I am using Excel VBA:
http.setRequestHeader "x-ebay-signature-key", jwe
http.setRequestHeader "signature", privateKey
http.setRequestHeader "signature-input", "sig1=(""x-ebay-signature-key"" ""#method"" ""#path"" ""#authority"");created=1666253648295"
jwe, privateKey and created time were acquired using the Management API createSigningKey call. I have noted that the creationTime in the API response has 13 digits instead of 10 like in the eBay example.
I receive the following response:
{
"errors": [
{
"errorId": 215114,
"domain": "ACCESS",
"category": "REQUEST",
"message": "The create time of signature parameters is not in right range",
"longMessage": "The create time of signature parameters is not in right range to fulfill the request."
}
]
}
I have tried using the 13 digit and 10 digits of the Unix timestamp, but get the same error with both. I presume that I am missing something, but am not sure what.

The Unix timestamp function I was using did not take into account daylight saving time in UK, so was 1 hour in the future. Having corrected this the timestamp is accepted.

Related

Time series insight API returning Could not cast or convert from System.String to Microsoft.Rdx.Client.Events.Property

Hi we have just started using time series insight .We need to list specified list of values of properties under particular Time series id .As per the documentation in azure we were using the following API in post method to achieve this .
https://XXXXX_EnvironmentFqdn_XXXXX.env.timeseries.azure.com/timeseries/query?api-version=2018-11-01-preview
When posting the following request body to the API
{
"getEvents":{
"timeSeriesId": ["UniqueId"],
"searchSpan": {
"from": "2019-02-17T00:00:00Z",
"to": "2019-02-18T00:16:50Z"
},
"projectedProperties": ["DesiredProp"]
}
}
it returns a 400 Bad Request with following error message.
{
"error": {
"code": "InvalidInput",
"message": "Error converting value \"DesiredProp\" to type
'Microsoft.Rdx.Client.Events.Property'. Path
'getEvents.projectedProperties[0]', line 9, position 45.\r\n---> Could
not cast or convert from System.String to
Microsoft.Rdx.Client.Events.Property.\r\n"
}
}
on removing the projectedProperties property from response body API works fine,but it will return all the properties of the time series .
any help will me much appreciated and thanks in advance .

Parse values from the JSON returned by URL of Google Place API

I am creating a bot using dialogflow-fulfillment, and I am using Google Place API to pull additional information about hospitals.
I have made a dummy response, for the sake of example, that is returned by Google Place API, here is the link: http://www.mocky.io/v2/5c2b9f9e3000007000abafe3
{
"candidates" : [
{
"formatted_address" : "140 George St, The Rocks NSW 2000, Australia",
"name" : "Museum of Contemporary Art Australia",
"photos" : [
{
"height" : 3492,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/105784220914426417603/photos\"\u003eKeith Chung\u003c/a\u003e"
],
"photo_reference" : "CmRaAAAAaGaCX-kivNEaJ-z97AduTYgW3d98uv53-8skNrS1k1GTgOtiQ1-Z2gfWJydrpkrshuV_kHPKizl088dezEJgIxYGoTWqtJgah-u_I46qNNYMfUbk8LKBZqxzkHyIL1nWEhBO6lPa0NgvlyLGBrXpXFPUGhT0lAUj_oCiOWV2MEYdBeKf-kTtgg",
"width" : 4656
}
]
}
],
"status" : "OK"
}
I need to parse values of my choice from the JSON returned by Google Place API. For example, If I had to parse value of 'name' from the JSON above using Python, I would do this:
import requests, json
api_key = ''
r = requests.get('https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Museum%20of%20Contemporary%20Art%20Australia&inputtype=textquery&fields=photos,formatted_address,name&key=' + api_key)
x = r.json()
y = x['candidates']
print(y[0]['name'])
Above code for the job is lucid and works perfectly. Considering my inexperience in Nodejs, would you please let me know something similar in Nodejs to parse the value, for instance, the value of 'name'?
Your valuable reply will encourage me.
P.S: Humbly, the question involves first making a call to Google Place API and then parsing values from the returned JSON. Please follow the steps given in Python code above for better understanding.
Get the API response in an async HTTP request (there are tons of npm libraries like request to help you automatically set headers etc), then use standard library JSON.parse(body) to get an plain JavaScript object which contains a structured representation of the API response.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse

Why can't send queue message text to an Azure Function?

I have an Azure Logic App with a queue trigger. The queue message is JSON. When I send "Message text" to an Azure function, I get
UnsupportedMediaType
{
"Message": "The WebHook request must contain an entity body formatted as JSON."
}
I'd assumed this would work directly.I tried setting request body to
#{json(<Message text>)}
where is the select dynamic content item, but I get red message "Enter a valid json".
What's the trick to making this connection? Do I have to pass in and then parse out "Message text" in my function? Again, I assumed it would do that automagically.
The #{} syntax indicates string interpolation. This means that your expression #{json(<Message text>)} de-serializes the message text to json, and then serializes it again.
Hence the expression that you want to use is
#json(<Message text>)
For future readers.
I was passing some (what seems to be to be valid) json to my webhook.
And kept getting the
"Message": "The WebHook request must contain an entity body formatted as JSON."
error.
:(
Finally, I found a json "expression" that did its voodoo and got rid of the error. I argument from the json-expression was my previous action's output, which was valid json. It apparently needs just a little help!
The raw (non designer) code was:
"GenericWebHookCsharpOne": {
"type": "Function",
"inputs": {
"body": "#json( body('MyPreviousAppLogicActionWhichIsAnAzureFunction'))",
"method": "POST",
"function": {
"id": "/xxxxxxxxxxxxxxxxxxxxxxxx
}

Azure Rest API " Resource not found for the segment 'messages?$filter=From'. "

I am trying to access messages for a specific folder which used to work. For some reason passing "?" in the url is rejected as "illegal character" in our api so I I have encoded the "?" to "%3F" and the final url looks like this:
https://graph.microsoft.com/v1.0/me/MailFolders/INBOX/messages?$filter=From/EmailAddress/Address eq 'alerts-noreply#mail.windowsazure.com'
The header contains the following.
("Authorization", "Bearer " + token)
("Content-Type", "application/json")
("Accept", "application/json")
("grant_type", "client_credentials")
I am using v1 of the Azure REST API as you can see. I can't understand what's happening.
Error I received.
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'messages?$filter=From'.",
"innerError": {
"request-id": "d2e9b359-d40d-4c0a-a0a5-b4e3cf4b5ecd",
"date": "2017-03-24T14:35:28"
}
}
}
I appericiate your help.
You can't encode the ? as %3F, that breaks it. By encoding it that way, you're indicating that it's not the query parameter separator, so the server is trying to find a segment called messages?$filter=From :).
I think the issue here is capitalization issues.
If you look at the query you have copied above, you have capitalized:
https://graph.microsoft.com/v1.0/me/MailFolders/INBOX/messages?$filter=From/EmailAddress/Address eq 'alerts-noreply#mail.windowsazure.com'
When these 3 letters need to all be lowercase (sample below from our documents):
GET https://graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/address eq 'jon#contoso.com'

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