I am using the "insert" API to add a message to Gmail, and using the query parameter internalDateSource=dateHeader. However Gmail seems to ignore the "Date" header that is in my RFC822 data, just substituting the current date. My POST url looks like this:
https://www.googleapis.com/gmail/v1/users/user#gmail.com/messages?uploadType=multipart&internalDateSource=dateHeader&access_token=XYZ
My uploaded data looks like this:
{
"labelIds": [ "Label_96" ],
"raw": "RnJvbTo...tDQr_"
}
There is no doubt that the correct "Date" header is in the encoded raw
data. (Here is an example):
Date: Wed, 1 Oct 2011 10:47:00 -08:00
Google picks up all the other headers and message data correctly. What am I doing wrong? BTW I did try adding "payload" and "headers" to my json in an attempt to specify a Date header. No change.
You have a typo in your Date-header. It should be:
Date: Wed, 1 Oct 2011 10:47:00 -0800
not
Date: Wed, 1 Oct 2011 10:47:00 -08:00
Related
Anyone know how to find metadata from react-dropzone. Currently out of the box it just shows the following:
path: "DSCF2953.jpg"
lastModified: 1643308695461
lastModifiedDate: Thu Jan 27 2022 10:38:15 GMT-0800 (Pacific Standard Time) {}
name: "DSCF2953.jpg"
size: 1442377
type: "image/jpeg"
It shows nothing about the date created type of camera and on....
Is there a way to get to extra file data ?
Tracked Properties of Logic Apps
I am trying to track properties in a Logic App workflow. My problem is I need to track some fields coming from HTTP action.
So my output of HTTP action is something like below.
{
"statusCode": 200,
"headers": {
"x-ms-request-id": "asdfsad",
"x-ms-client-request-id": "ASFSDF",
"x-ms-version": "2020-10-02",
"x-ms-creation-time": "Fri, 05 Nov 2021 12:55:54 GMT",
"x-ms-lease-status": "unlocked",
"x-ms-lease-state": "available",
"x-ms-blob-type": "BlockBlob",
"x-ms-server-encrypted": "true",
"Accept-Ranges": "bytes",
"Date": "Wed, 10 Nov 2021 07:52:11 GMT",
"ETag": "\"SDFGSDGF\"",
"Server": "Windows-Azure-Blob/1.0,Microsoft-HTTPAPI/2.0",
"Content-Length": "1996",
"Content-MD5": "co+35ZaNw7Be9sgn6YB7OA==",
"Content-Type": "text/xml",
"Last-Modified": "Wed, 10 Nov 2021 07:52:11 GMT"
},
"body": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Customer xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://company.Schemas\">\r\n <Company xmlns=\"\">\r\n <CompanyCode>dk01</CompanyCode>\r\n <CompanyIdEcom />\r\n <BillTo>\r\n <CustomerNo>4004002</CustomerNo>\r\n <CreditLimit>0</CreditLimit>\r\n <BlockingLevel>0</BlockingLevel>\r\n <CurrencyCode>DKK</CurrencyCode>\r\n <PaymentTerms>N30</PaymentTerms>\r\n <BillToAddress>\r\n <PostalCode>2750</PostalCode>\r\n </BillToAddress>\r\n <SellTo>\r\n <SellToAddress>\r\n <Address>Lautrupbjerg 7 Postbox 99</Address>\r\n <PostalCode>2750</PostalCode>\r\n <CountryCode>DK</CountryCode>\r\n </SellToAddress>\r\n <ShipTo>\r\n <Code>5637147732</Code>\r\n <ShipToAddress>\r\n <Name>Siemens Medical Instr. Pte.Ltd</Name>\r\n <City>Singapore</City>\r\n <PostalCode>139959</PostalCode>\r\n <CountryCode>SG</CountryCode>\r\n </ShipToAddress>\r\n </ShipTo>\r\n <CustomerNo>4004002</CustomerNo>\r\n <Name>GN Audio A/S</Name>\r\n <Searchname>1000-500092,5479</Searchname>\r\n <CurrencyCode>DKK</CurrencyCode>\r\n <PrimaryContactEmail />\r\n <ModeOfDelivery>AIR DHL EX</ModeOfDelivery>\r\n </SellTo>\r\n </BillTo>\r\n </Company>\r\n <IsDelta xmlns=\"\">true</IsDelta>\r\n</Customer>"
}
I am not able to figure out how I can track Customer no from the XML.
outputs('HTTP-GetBlob')?['body'] (..??????.....)
As far as I remember, tracked properties can only reference #triggerBody, current #action()['inputs'] and #action()['outputs'] - nothing else.
In your case, you'd need to configure tracked properties on your HTTP-GetBlob action like this:
#xpath(xml(action()['outputs']['body']), '(//CustomerNo/text())[1]')?[0]
- experiment with xpath and adjust it to your liking.
One of the workarounds that you can try is to convert the XML into JSON then parse it and then use the required parameters accordingly.
Here are the screenshots for your reference
Here is the output
I am downloading a Helm chart from https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz. (The fact that it is Redis or related to Helm or anything in particular is irrelevant to this question, which is just about things like Content-Encoding and so on.)
When I check its headers like this:
$ curl -H "Accept-Encoding: gzip" -I https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz
…I do not see a Content-Encoding header in the output, and the Content-Type is listed as being application/x-tar:
HTTP/1.1 200 OK
X-GUploader-UploadID: AEnB2UqBzSXfTToMAdMARXSjJeN0on3jaNY3u74eXcWfvqsOwRpi38Xc6T0XrrmY4otPeySaYRwXyHccHYtChoPAgFQwYZhQMhcpZRWtZURRANGdfRJoupI
Expires: Tue, 27 Jun 2017 00:21:59 GMT
Date: Mon, 26 Jun 2017 23:21:59 GMT
Cache-Control: public, max-age=3600
Last-Modified: Fri, 05 May 2017 03:03:41 GMT
ETag: "e4184c81a58fb731283847222a1f4005"
x-goog-generation: 1493953421241613
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 3550
x-goog-meta-goog-reserved-file-mtime: 1493953414
Content-Type: application/x-tar
x-goog-hash: crc32c=bQHveg==
x-goog-hash: md5=5BhMgaWPtzEoOEciKh9ABQ==
x-goog-storage-class: STANDARD
Accept-Ranges: bytes
Content-Length: 3550
Server: UploadServer
Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,36,35"
The resulting file, when downloaded, is a gzipped tar archive.
What is the proper way of programmatically detecting that the payload is in fact gzipped? Or is this a problem with the web server in question?
I think the server is misconfigured. Since .tgz is just abbreviation for .tar.gz it should get the content type application/gzip-
Content-Type: application/x-tar
this header tells you the type, but i'm not sure that's gzip
https://superuser.com/questions/901962/what-is-the-correct-mime-type-for-a-tar-gz-file
see accepted answer at
How to check if a file is gzip compressed? . for way to identify programmatically
I'm trying to send an email to a gmail account containing a link which looks like this:
http://www.example.com/#/something#param=1
This is a link to an AngularJS application which needs the second '#' as a separator.
The problem is that gmail changes the seconds '#' to '%23' and this causes the application not to recognize the char as a separator.
Is there anything I can do with this?
Thanks.
I did a quick test using gmail to try to figure out what happens.
Here is the raw message
MIME-Version: 1.0
Received: by 10.96.50.232 with HTTP; Mon, 19 Jan 2015 05:44:30 -0800 (PST)
Date: Mon, 19 Jan 2015 14:44:30 +0100
Delivered-To: *******#gmail.com
Message-ID: <CPZt8dX3Q17wXmU7UT2iXp7q4tSn1UsDmyiUbXFVK7xE2Q0C10A#mail.gmail.com>
Subject: test
From: <name> <*******#gmail.com>
To: <name> <*******#gmail.com>
Content-Type: multipart/alternative; boundary=20cf303b41179134a6050d0185f4
--20cf303b41179134a6050d0185f4
Content-Type: text/plain; charset=UTF-8
http://www.example.com/#/something#param=1
--20cf303b41179134a6050d0185f4
Content-Type: text/html; charset=UTF-8
<div dir="ltr">http://www.example.com/#/something#param=1<br></div>
--20cf303b41179134a6050d0185f4--
The original message is showing the correct values, but I also noticed how my actual gmail client shows the second # as the html encoded %23.
Surprisingly enough, in contrast to what I suggested in my comment, using plain-text will actually give the desired result.
MIME-Version: 1.0
Received: by 10.96.50.232 with HTTP; Mon, 19 Jan 2015 06:06:39 -0800 (PST)
Date: Mon, 19 Jan 2015 15:06:39 +0100
Delivered-To: *****#gmail.com
Message-ID: <KMBt8bX2CrmEL66iRFAJ+_s_1W2eodD=9X=bMdsBK_13qzh6DaA#mail.gmail.com>
Subject: test4
From: <name> <*****#gmail.com>
To: <name> <*****#gmail.com>
Content-Type: text/plain; charset=UTF-8
http://www.example.com/#/something#param=1
I don't know how your AngularJS application reads the link from the email, so plain-text may not be an option, but the link in the above email is mapped to http://www.example.com/#/something#param=1 in my gmail client.
It seems that over night the Google Drive API methods files().patch( , ).execute() has stopped working and throws an exception. This problem is also observable through Google's reference page https://developers.google.com/drive/v2/reference/files/patch if you "try it".
The exception response is:
500 Internal Server Error
cache-control: private, max-age=0
content-encoding: gzip
content-length: 162
content-type: application/json; charset=UTF-8
date: Thu, 22 Aug 2013 12:32:06 GMT
expires: Thu, 22 Aug 2013 12:32:06 GMT
server: GSE
{
"error": {
"errors": [
{
"domain": "global",
"reason": "conditionNotMet",
"message": "Precondition Failed",
"locationType": "header",
"location": "If-Match"
}
],
"code": 500,
"message": "Precondition Failed"
}
}
This is really impacting our application.
We're experiencing this as well. A quick-fix solution is to add this header: If-Match: * (ideally, you should use the etag of the entity but you might not have a logic for conflict resolution right now).
Google Developers, please give us a heads up if you're planning to deploy breaking changes.
Looks like sometime in the last 24 hours the Files.Patch issue has been put back to how it used to work as per Aug 22.
We were also hitting this issue whenever we attempted to Patch the LastModified Timestamp of a file - see log file extract below:
20130826 13:30:45 - GoogleApiRequestException: retry number 0 for file patch of File/Folder Id 0B9NKEGPbg7KfdXc1cVRBaUxqaVk
20130826 13:31:05 - ***** GoogleApiRequestException: Inner exception: 'System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Google.Apis.Requests.Request.InternalEndExecuteRequest(IAsyncResult asyncResult) in c:\code.google.com\google-api-dotnet-client\default_release\Tools\BuildRelease\bin\Debug\output\default\Src\GoogleApis\Apis\Requests\Request.cs:line 311', Exception: 'Google.Apis.Requests.RequestError
Precondition Failed [500]
Errors [
Message[Precondition Failed] Location[If-Match - header] Reason[conditionNotMet] Domain[global]
]
'
20130826 13:31:07 - ***** Patch file request failed after 0 tries for File/Folder 0B9NKEGPbg7KfdXc1cVRBaUxqaVk
Today's run of the same process is succeeding whenever it Patches a files timestamp, just as it was prior to Aug 22.
As a result of this 4/5 day glitch, we now have hundreds (possibly thousands) of files with the wrong timestamps.
I know the API is Beta but please, please Google Developers "let us know in advance of any 'trialing fixes'" and at least post in this forum to acknowledge the issue to save us time trying to find the fault in our user programs.
duplicated here Getting 500: Precondition Failed when Patching a folder. Why?
I recall a comment from one of dev videos saying "use Update instead of Patch as it has one less server roundtrip internally". I've inferred from this that Patch checks etags but Update doesn't. I've changed my code to use Update in place of Patch and the problem hasn't recurred since.
Gotta love developing against a moving target ;-)