How to retrieve JSON object from google sheets and not HTML - node.js

I m sending a GET request to a published google sheets. All the tutorials show that a JSON object is returned but I receive HTML. Is it due to an update? How can I parse it into JSON?
Published sheet: https://docs.google.com/spreadsheets/d/e/2PACX-1vTLSQ-WGM8O0iCCTal0eFoAvFFIVK04UxUiCuBJLGVy89EY301-0cF5PZupIXh-sF_L9pHIw6tVtN1G/pubhtml
Expected output when you go to the link: JSON object
Obtained output: HTML
References:
https://sandbox.idre.ucla.edu/sandbox/general/databasing-google-spreadsheets-to-json
https://medium.com/storyline-blog/how-to-create-a-dynamic-alexa-skill-using-google-sheets-and-storyline-9fd37f2080d8
In these, JSON is returned when a request is made whereas I receive an HTML
An example of google sheet returning JSON:
https://spreadsheets.google.com/feeds/list/SPREADSHEET_ID/od6/public/basic?alt=json

When you publish a google sheet, you are prompted by a pop displaying a link such as
https://docs.google.com/spreadsheets/d/e/2PACX-1vTVZ3fWRSMu5nFGUc05ACV1h0-UGW49wi9lHAyJVUMp8FX3TANqy_9WNhkcd4z1mJSSN-LZyyBdS_vK/pubhtml
2PACX-1vTVZ3fWRSMu5nFGUc05ACV1h0-UGW49wi9lHAyJVUMp8FX3TANqy_9WNhkcd4z1mJSSN-LZyyBdS_vK is not the skill id
The skill ID is present in the search bar. For example the search bar has the link, https://docs.google.com/spreadsheets/d/1bm6Fjiacmuh0qRjuHoBU35AHPdF7S4R7BEIK46H0wUo/edit#gid=0
where 1bm6Fjiacmuh0qRjuHoBU35AHPdF7S4R7BEIK46H0wUo is the link.

Related

How to get the test result attachments from azure devops (api)

I can get and upload attachments to the test result (green on screen)
But how can I get result attachments that uploaded manually by Web runner (red on screen)
enter image description here
Use this API doc
https://learn.microsoft.com/en-us/rest/api/azure/devops/test/attachments?view=azure-devops-rest-5.1
The point is I see the attachment id by mouse hover, so the ID aasighned to the attachments, but can not get it via API.
enter image description here
Hi I opened the F12 mode to capture the request calls in the current page, and I searched my attachment name in the network traces and found the rest api to list my target attachment.
And the api below looks similar to that in the doc you shared about Attachments - Get Test Sub Result Attachments, and with this api, you could get the attachment ID.
get https://vstmr.dev.azure.com/<org>/<proj>/_apis/tcm/runs/8/results/100000?detailsToInclude=5&api-version=5.1-preview.1
So I modify the Attachments - Get Test Sub Result Attachment Zip, adding the query filter of detailsToInclude=5 like below.
https://vstmr.dev.azure.com/<org>/<proj>/_apis/tcm/runs/<runID>/results/<resultID>/attachments/<attachmentID>?detailsToInclude=5&api-version=5.1-preview.1
And I download the attachment correctly.
Azure has Test Point instance
A test point is a unique combination of test case, test suite, configuration, and tester
Test Point - Get Points
From the Test Point I got "lastTestRunId" and the relevant Test Result: Results - List .
Test Result has the attachments by his own, but also manual testing test result iterations there, that in turn has attachments as well.
So, to get attachment id I should got the Iteration first:
Iterations - Get
-> "attachments": []

How to send Stringified data as body in Postman?

I have an IOT service in aws and it posts data to a pipeline. The data posted is in the form of string and the body contains just the string as follows:
"{\"Time_Stamp\":1662449255,\"IMEI\":\"860987053151997\",\"BPID\":\"0\",\"Warn\":\"1000\"}\r\n"
I am parsing the data to JSON and then extracting it on my server but I want to know that if I wanted to test this in postman then how do I make a request? How to send the following data as body so that I could parse it locally for debugging?
First and foremost select your request type like - POST, GET, etc
then select Body and under the body select the 4th option raw
And after the 5th option there is a dropdown with text, javascript,JSON
so, select JSON and paste your JSON data and call your API
I think the solution was similar like this documentation
You can type your JSON, into the raw (JSON). And it will be seen like this picture.
If you still need to learn more, let's take an exercise session with this collection.
Thank you

download signed document as JSON from docusign

It seems that docusign only supports downloading the signed documents as PDF instead of JSON.
I need to 'read' the filled fields of the documents (the document has some fields to fill in).
I can upload the document as JSON and it gets parsed, so why can't I donwload it as JSON?
How do companies normally handle the field values?
Thanks!
You don't need the actual PDF document to get the values, you need to parse the call coming back from DocuSign since that has total envelope data. The webhooks for notification contains the data and you can parse that to retrieve the envelope data.
Do you know if its also possible with a GET call instead of the webhook? It could be the server is down etc, so I can't imagine DocuSign does have something like GET:envelope/:id/data or something.. But really cannot find anything like it
Yes. You can either use a GET call (included below) any time you want to get envelope data or you can set up the webhooks so that DocuSign will send you updates whenever it has one!
The following GET call retrieve envelope data from {{envelopeId}}. By parsing the response from the call you can retrieve all information that was filled on the envelope.
{{baseUrl}}/envelopes/{{envelopeId}}/recipients?include_tabs=true
I hope this helps.
P.S. Summarized our comments to have a complete answer.
The PDF format is, for lack of better words, a complicated jumble of compiled data that can be difficult to parse. What it appears docusign will do is take the data provided and fill the PDF document fields that are previously identified.
With docusign returning the PDF, you will need to parse the PDF input fields to receive the field values. There are several libraries that can be used to parse the various form fields and do what you would like. Check out:
https://www.npmjs.com/package/pdfreader
https://www.npmjs.com/package/pdf2json
I am sure there are more that would work for you as well if you look around if these don't work for you.

How does a Gmail message Id or ThreadId map to the new Gmail UI?

Edit: addressing the first comment below and for clarity, this isn't a code question. The question is simply:
What do I put into the URI querystring of the new Gmail UI to view a draft message created by the Gmail API?
Despite this not really being a code question, I'm asking on Stack Overflow as it's Google's preferred platform for Gmail API questions.
--
If I view a draft message in the new Gmail UI, the URI is something like this:
https://mail.google.com/mail/u/1/?zx=iij9apqgzdf4#drafts?compose=jrjtXSqXwlFGnSGCQgDCdnHGVFdlpFMgzsCNgpQstQLxdLCMkjKstBmWZkCmjhWTQnpsZCJF
I can't see any way to create such a link from the Id or ThreadId of a message created via the Gmail API.
Previously, one could do this:
https://mail.google.com/mail/u/1/?zx=ov61dxfbrcga#drafts?compose=1631caae9dbb074d
where the value of "compose" is the Id.
How can the same thing be accomplished in the new UI?
I've been encountering the same problem and have had some success in this problem, as well as some issues I still can't get past.
Good news: The new compose parameter format is some kind of "base40" encoding. I searched the Gmail source for a restricted alphabet string, and found and deobfuscated the bit of code doing this encoding/decoding: https://gist.github.com/danrouse/52212f0de2fbfe33cfc56583f20ccb74
This code includes an encode and decode function which should work for Gmail-format query parameters.
Bad news: The values that it is encoding to open draft emails do not appear to be available using the Gmail API. Specifically, they look like this:
thread-f:NEW_THREAD_ID+msg-a:DRAFT_ID -- while the draft ID is the same as it was before, the Thread ID does not appear to match any of the IDs that the Gmail API returns.
Interestingly, if you inspect the subject row in the Gmail UI, it has dataset attributes including all of both the old format and new format IDs - but it's still unclear how to get the new ones programatically.
Thanks to #frank-szilinski - he pointed out that the old format is now translated. I.e. this now works again:
https://mail.google.com/mail/ca/u/1/#drafts/1661237c4db71ace
It doesn't seem to work when the Gmail tab isn't already open, however.
Building on #kremonte gist, and #chris-wood comments, I made a rails gem that correctly creates the open-the-draft-inside-gmail URL.
It's here - https://github.com/GoodMeasuresLLC/gmail_compose_encoder
It's for the use case of "my code created a draft (prepopulated with some text, of course) and now I want to open the draft in compose mode so that my user can review it before hitting "send".
How to get the URL for a draft
If, for example you use a list request from which you get your draft objects:
{
"id": string,
"message": {
object (Message)
}
}
You can take this id and put it into a URL in this format:
mail.google.com/mail/#inbox?compose=[id]
Eg.
mail.google.com/mail/#inbox?compose=3doinm3d08932d
This will open up GMail with the relevant draft open.
I was struggling because I wanted it to work with multiple accounts. However the authuser parameter did not help.
Inserting the email address instead of the integer after the u/ component solved the problem.
https://mail.google.com/mail/u/{email_address}/#drafts?compose={message_id}
The message id is the one provided by the API.

Parse-Server query fed directly from URL query string

I'd like to know if this is even possible. And if it is possible, what the security ramifications would be.
I want to use Javascript to build a dynamic URL to query a Parse-Server database.
It appears that it might be possible based on an earlier Stackoverflow question here and a Node.js doc here
Here's how I envision it working....
So, a user would be sent (via email/Twitter/etc) a link which was created by above method. Once the user clicked on that URL link, the following would happen automatically:
Step #1: User's system would automatically submit a parse-server query.
Step #2: On success, the user's browser would download a web page which displayed the query results.
step one create the pointer value ie the query pseudo-semantic
step 2 insert the pointer value to a text-type field in parse cls=clazz
step 2b mailgun a msg containing a link like :
express.domain.com/#!clazz/:yALNMbHWoy - where 'yA...oy' is oid of pointer row in parse/clazz table
Note that the link is an abstraction only. Its a uri first to express/route && function that will simply get a row from parse.clazz. That row contains the semantic for making a parse query to get back the full DB compliment to pass along to the node template setting up the html ...
in your node/router GET/clazz/:oid will lookup that Parse row in parse/clazz, using the pointer/text value to format a 2nd, Parse query. The query response from the 2nd parse.qry is your real meat ... This response can be used by the express template formatting the html response to orig request on "express.domain.com".
where u ask "download web page" .. that is simply node's RESPONSE to a GET on a route like "GET/clazz".

Resources