Azure blob GET request authorization header "x-ms-date" field issue - azure

I am trying to fetch a html page which is placed in Azure blob storage using postman. The default blob storage access has been set to private, so i have to send "Shared Key", "x-ms-version" and "x-ms-date" in the header section to Authorize.
Here is the screen shot of request in Postman.
When i click on send button i am getting an error stating "The date header in the request is incorrect".
Any ideas to solve the issue?
Update-Corrected Date Format
I corrected the "x-ms-date" format, now it throwing an error stating Authentication Info is not in correct format
Here is the Authorization section of postman
Thanks for the help.

Please review the documentation.
You need to specify two headers for correct request: Authorization and x-ms-date headers.
The correct format for x-ms-date header is Fri, 26 Jun 2015 23:39:12 GMT.
It seems your Authorization header is invalid.
Try to regenerate your SAS key and test your request again.
As I understand correctly then you have only 15 minutes for requests.
From documentation:
The storage services ensure that a request is no older than 15 minutes by the time it reaches the service. This guards against certain security attacks, including replay attacks. When this check fails, the server returns response code 403 (Forbidden).

The format is Fri, 26 Jun 2015 23:39:12 GMT. In Python, this can be obtained via
import datetime
date = datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
assuming locale.en_US.

x-ms-date header must be specified in the following format: Fri, 26 Jun 2015 23:39:12 GMT.
Please try your request again with this format.

The format that you should have is:
Thu Apr 7 16:55:44 CET 2022

Related

DocuSign - Unable to convert document

We’re getting an error – “unable to convert document” for one of our clients on our multi-tenant server. I’ve had a rummage and it looks like that error is generated when you’re sending a file with an unexpected extension meaning that DocuSign doesn’t know how to convert it to a PDF (https://stackoverflow.com/questions/53771197/docusign-random-unable-to-convert-document-error). What I’m failing to understand is how it can be working for some – it works for me on our multi-tenant server – but not others. Is there more to this than meets the eye or am I missing something?
Headers : X-RateLimit-Reset: 1573833600
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 991
X-DocuSign-TraceToken: #####
Strict-Transport-Security: max-age=31536000; includeSubDomains
Cache-Control: no-cache
Date: Fri, 15 Nov 2019 15:20:40 GMT
Response stream : {
"errorCode": "UNABLE_TO_CONVERT_DOCUMENT",
"message": "System was unable to convert this document to a PDF. Unable to convert Document(2019.11.15_NDA - MyDocument) to a PDF. Error: UserId:##### IPAddress:##### Source:ApiRESTv2:FileType 15_nda - my document is ineligible for conversion."
}
Check that you are setting the fileExtension attribute to pdf in the document object in your Envelopes::create call.
If you don't set it, DocuSign does some guessing, but setting the attribute explicitly is the way to go.

Google Sheets API Post

I'm working on a chatbot project. I want users to be able to enter list items onto a Google Sheet. The chatbot is on DialogFlow, I created the intent, and toggled the webhook on. I am now in Google Cloud Functions and creating a function to POST the new item on the google sheet. I have already been successfully able to read (GET) the list of items from the sheet to be displayed to the user in the chatbot.
I am new to nodejs and admittedly don't know much about Oauth, but I set my sheet to be able to be edited by anyone on the internet and I have a working API key as well. To try to just get down to basics, I went on https://apitester.com to test the HTTP request there. I can GET a response easily that returns the list of items I already have. However, my POST response is still returning issues, although the site did indicate that the request "PASS"ed.
My POST request
https://sheets.google.com/v4/spreadsheet/<SPREADSHEETID>/values/A1:append?includeValuesInResponse=true&key=<MY_API_KEY>
where <SPREADSHEETID> and <MY_API_KEY> match my credentials.
My request body:
{
"values": [ ["Hello", "World"] ],
"range": "Sheet1!A1:B1",
"majorDimension": "ROWS"
}
Response:
HTTP/1.1 301 Moved Permanently
Location: https://docs.google.com/spreadsheets?usp=direct_url
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Date: Thu, 18 Oct 2018 07:31:14 GMT
Expires: Sat, 17 Nov 2018 07:31:14 GMT
Cache-Control: public, max-age=2592000
Server: sffe
Content-Length: 248
X-XSS-Protection: 1; mode=block
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"
I looked up the 301 error code and found that it is a redirection message that signifies a server-side error. I read that it should be self-fixing as your request will just be-redirected to the appropriate site in the Location value above. But I also copied the Location link and found it just took me to my personal Google Drive. I read elsewhere that this may occur because Google is communicating over a secure link. I checked my Google sheet just in case, but nothing had changed there.
Anyway, is it possible to test the append request before I code it into my Google Cloud Function? If so, where can I test and how can I make sure that the request goes through (with hopefully just an API key and no Oauth creds)?
I tried doing this on the documentation page (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append) ("Try This API" on the right-hand side) but I just get a never-ending red progress circle.
Please help! If the only answer is Oauth, please help me past directing me to the Oauth documentation, as I have not found that very helpful.
Thank you!
EDIT 1
Okay, I have been trying some things out. Oauth playground wasn't working for me, but this website (https://developers.google.com/apis-explorer/#p/sheets/v4/sheets.spreadsheets.values.append) allowed me to POST a new row to my spreadsheet. (I had to toggle Authorize OAuth 2.0 to ON.)
So now I have the Oauth working, how can I translate this into my Google Cloud Function using node.js? Do I save my Oauth tokens to certain variables and then add them to headers?

Using Acumatica REST API with Microsoft Flow

Has anyone tried using the Acumatica REST APIs with Microsoft Flow?
I tried it a few weeks ago using Sergey's instructions (click here) and it worked fine.
But now I'm getting the following message on the second step.
{
"message": "You are not logged in."
}
The first step is where I authenticate (just like in Sergey's instructions), then I pass the headers from the first step to the second step (just like in Sergey's instructions), but somehow the second step doesn't think that I'm logged in.
Any ideas?
Here are some screenshots (the only thing I changed for the screenshot is the password):
https://i.imgur.com/uD3CpCa.png
https://i.imgur.com/CZ6XLsW.png
https://i.imgur.com/8XB1LT2.png
Here are the Headers Outputs from the first call (HTTP):
X-Handled-By
Acumatica-PX.Export/AuthenticationManagerModule
Set-Cookie
ASP.NET_SessionId=0koh1ysshqsfmzr0srib2s5z; path=/; HttpOnly,UserBranch=16; path=/,Locale=Culture=en-US&TimeZone=GMTM0800A; expires=Sat, 18-Nov-2017 17:51:27 GMT; path=/,.ASPXAUTH=880C71F4E1A76C36E7E468337C01BC9E6E4C898E1977BAAAF2A35F7217B1D9132794A9547071508A35A2D4B9132DC4B55E86DD6E9C9B8D46CAECE39D74CC9B44BDD47E7C0D836D22D8F4EEFAF8142A9987418B8003EFF5B340DF735E7F8F36EDE5D25300D887E4DADEB0A80B707D87F6B0D32437; path=/; HttpOnly
Server
Microsoft-IIS/7.5
X-Powered-By
ASP.NET
Date
Wed, 15 Nov 2017 17:51:27 GMT
Content-Length
0
Here are the Headers Inputs from the second call (HTTP 2):
{
"X-Handled-By": "Acumatica-PX.Export/AuthenticationManagerModule",
"Set-Cookie": "ASP.NET_SessionId=0koh1ysshqsfmzr0srib2s5z; path=/; HttpOnly,UserBranch=16; path=/,Locale=Culture=en-US&TimeZone=GMTM0800A; expires=Sat, 18-Nov-2017 17:51:27 GMT; path=/,.ASPXAUTH=880C71F4E1A76C36E7E468337C01BC9E6E4C898E1977BAAAF2A35F7217B1D9132794A9547071508A35A2D4B9132DC4B55E86DD6E9C9B8D46CAECE39D74CC9B44BDD47E7C0D836D22D8F4EEFAF8142A9987418B8003EFF5B340DF735E7F8F36EDE5D25300D887E4DADEB0A80B707D87F6B0D32437; path=/; HttpOnly",
"Server": "Microsoft-IIS/7.5",
"X-Powered-By": "ASP.NET",
"Date": "Wed, 15 Nov 2017 17:51:27 GMT",
"Content-Length": "0"
}
Here are the Headers Outputs from the second call (HTTP 2):
X-Handled-By
Acumatica-PX.Export/AuthenticationManagerModule
Date
Wed, 15 Nov 2017 17:51:27 GMT
Set-Cookie
ASP.NET_SessionId=dklemj2usv2zveyc3acxnhm5; path=/; HttpOnly
Server
Microsoft-IIS/7.5
X-Powered-By
ASP.NET
Content-Length
36
Content-Type
application/json; charset=utf-8
I had one previously and the difference that I see between your and mine is that your login post doesn't have any headers.
Mine had :
Accept application/json
Content-Type application/json
Here is a screenshot of my working flow : https://imgur.com/a/trgBa
EDIT :
After playing with this a bit more I have found a way off making this work. though it is using OAuth authentication instead of cookie based authentication.
Here is how :
I first created a connected application on the screen of the same name in acumatica
Of the following type : Ressource Owner Password Credentials
I also created added a shared secret while taking note of its value (it is only showed once).
I created the first http call in flow using the following information
URL : https://"Acumatica ERP instance URL"/identity/connect/token
Header : Content type / application/x-www-form-urlencoded
Body : grant_type=password&client_id=Value1&client_secret=Value2&username=Value3&password=Value4&scope=api
Value1 : ID of the connected application created in step 1
Value2 :Value of the shared secret saved from step 1. If lost just remove and add another secret. just be careful no one else is using that secret
Value3 : Username of existing account
Value4 : Password of account specified in value 3
Create the second HTTP call that will do the web service request
URL : https://"Acumatica ERP instance URL"/entity/Default/17.200.001/Case
Header : Authorization / bearer substring(substring(string(body('HTTP_2')),indexOf(string(body('HTTP_2')),':'),34),2,32)
Body : a normal REST API body for the requested operation
The Substring is only separated by a space in the header
Here are image representing the 2 HTTP calls

Fiddler: The input authorization token can't serve the request. Please check that the expected payload is built as per the protocol,

I want to query DocumentDB in Fiddler
So as mentioned in this link, i am using POST method as follows
URL: https://documebtdbaccount:443/dbs/ToDoList/colls/Items/docs
User-Agent: Fiddler
Host: documentdbaccount:443
Content-Length: 0
x-ms-date: Tue, 10 Jan 2017 06:15:00 GMT
x-ms-version: 2016-07-11
authorization: type=master&ver=1.0&sig=masterkey
Content-Type: application/query+json
Accept: application/json
x-ms-documentdb-isquery: True
I am getting below error, not sure what it is about
message=The input authorization token can't serve the request. Please
check that the expected payload is built as per the protocol, and
check the key being used. Server used the following payload to sign:
'post docs dbs/ToDoList/colls/Items tue, 10 jan 2017 05:43:20 gmt
'
ActivityId: a0df52a6-1629-4437-8d15-c82eb02df278
Check your object ID for any prohibited characters.
As per this answer:
The following characters are not supported for the Id property of document: '/', '\\', '?', '#'.
Also, Id cannot end with an empty space.
I've had an extra white space character at the very end of the payload object ID.
It introduces a mismatch between the POST URL (which doesn't has this trailing space) and the actual payload content (which still has it). Thus this error appeared. Removing the trailing space fixed the issue.
Check your authorization key that you are passing in.

API call limit in Salesforce

Can I get to know or check how many calls have been made to Salesforce in C#?
This will help me in checking Call count limitation to user and update same to him.
Yes, you can use the LimitInfoHeader from the Partner API to monitor the current API usage.
<soapenv:Header>
<LimitInfoHeader>
<limitInfo>
<current>5</current>
<limit>5000</limit>
<type>API REQUESTS</type>
</limitInfo>
</LimitInfoHeader>
</soapenv:Header>
It is also available in the REST API - Limit Info Header.
HTTP/1.1 200 OK
Date: Mon, 20 May 2013 22:21:46 GMT
Sforce-Limit-Info: api-usage=18/5000

Resources