How to get the embed url for google docs presentation? - google-docs-api

It looks like recently there has been a slight change on embedding a published google docs presentation.
The url for the iframe embed changed from:
https://docs.google.com/present/embed?id=[doc_id]
To:
https://docs.google.com/presentation/embed?id=[doc_id]
Looks like some old documents still require the old embed url, and the new documents require the new url. So given a doc_id is there a way (using the API) to get the embed url you should be using?
update:
After poking around, it looks like from the revision, the old doc has link tag with rel=http://schemas.google.com/docs/2007#publish, which contains https://docs.google.com/present/embed?id=[doc_id], but on the new doc that value is https://docs.google.com/feeds?xoauth_requestor_id=[user_email].
So the question is can I assume that if the link with rel=http://schemas.google.com/docs/2007#publish contains https://docs.google.com/feeds?xoauth_requestor_id=[user_email] then I need to use this url https://docs.google.com/presentation/embed?id=[doc_id]?
Or is it just that the API didn't include the correct value in the revision? (because I think this just happened quite recently).

The embed link has rel="http://schemas.google.com/docs/2007#embed" and URLs might look like https://docs.google.com/presentation/d/PRESENTATION_ID/preview. However, you shouldn't manually build those URLs but instead use the value of the link with rel="http://schemas.google.com/docs/2007#embed".
The xoauth_requestor_id parameter won't be included in the embed link as that is only required when using 2-legged OAuth and impersonating a different user. If that is the authorization mechanism of your choice, you have to add those parameters yourself when adding the auth token.

Related

NativeScript - How to create a webview with request blocking/redirection?

I'm trying to create a webview with the capability to block/redirect certain urls requested inside the webview (not just the page url, but also the requests sent from the page, think of it as what a browser extension is able to do).
After some research, the closest I get was this Swift/Obj-c approach of use NSUrlProtocol: https://www.raywenderlich.com/2292-using-nsurlprotocol-with-swift, and the doc of the native-webview-ext mentioned something about WKURLSchemeHandler https://github.com/Notalib/nativescript-webview-ext .
I'm new to mobile development and this feature is crucial for my project. I wonder if anyone has experience building this out in NativeScript, I hope I don't have to convince my team and my boss to write this in Swift instead :(.
As you see in the webview-ext plugin docs, it does support overriding resource urls. Refer the registerLocalResource method.
Just in case, even if that is not supported you don't have to write your whole project in Swift as you can always access all native apis from JavaScript / TypeScript itself, read more about it here.

Brackets Shell URI

Does anyone know if Brackets Shell uses any URI except the file://...index.html format? I want to point a web service back to the shell and need to provide a valid URI with the URL. The problem is that I noticed that the URL for the index file uses basic system paths and this can change per system or user configuration.
Any way around this little problem?
Edit:
I am trying to access the Instagram API through brackets shell. In order to gain an access token to the OAuth method they use I need to redirect the user to the Instagram Login page to log in then grant access and then Instagram will redirect them back to me based on the call back or redirect url provided from me. If it was as simple as providing just the URL when the call was made I would be fine however to get a client key (which is also needed to access the api) I need to provide the correct call back URL once the key is made and since the shell seems to have no custom file path it's almost impossible to predict the file path based on each users setup on their own pc's. I hope this made sense :)
I searched the source of the brackets-shell, but couldn’t find the startup path. A quick workaround would be adding a meta-refresh to your index.html which redirects to the corresponding URL of your web service.
For example:
<meta http-equiv="refresh" content="0; url=http://example.com">
If you don’t want to select your index.html each time you start your custom shell, you should place your index.html at
Mac: Brackets.app/Contents/dev/src/index.html or Brackets.app/Contents/www/index.html
Win: dev/src/index.html or www/index.html (these folders must be in the same folder as Brackets.exe)
Linux: dev/src/index.html or www/index.html (these folders must be in the same folder as the Brackets executable)
You can get the current location through javascript using
document.location.href
this will return a string like
"file:///C:/Program%20Files%20(x86)/YourApp/www/index.html"
which you might try sending to Instagram. I'm not sure if they will accept file URI's though.

How do you perform a resumable upload to a google docs collection? Namely using Java and g-data library

I've got a working system to upload to the default root using resumable uploads and I've been able to make the meta data in a collection but I need to be able to do this type of upload straight to a collection or sub collection.
My main problem is the url, there's no defined example of a straight upload path to a collection?
I assumed that it would be like:
https://docs.google.com/feeds/upload/create-session/default/private/full/folder%3A[folder_id]/contents
considering that the typical upload path is similar except without the upload/create-session part?
In a folder entry, look for a link like this:
<link rel="http://schemas.google.com/g/2005#resumable-create-media"
type="application/atom+xml"
href="https://docs.google.com/feeds/upload/create-session/default/private/full"/>
The href is what you need to send to to create the file in that folder.
p.s. Have you considered using the new Drive API? It has this funcitonality and is considerably better to use.
Turns out I was originally correct and the URL I provided was correct for uploading but the function I created for generating the URL was missing out the / between feeds and upload

I want to use an HTML page in my grails app. But Not able to

I am using grails 2.0.1 and i tried linking to the html page using with the direct url="somefile.html> but it is not working out . How do i do it ?please help
You need to do two things:
Make sure the file is stored under web-app/somefile.html, this is where you store raw files for the server.
Instead of using a hard-coded URL, use the g.resource() method or the <g:resource> tag. In these cases, you'll use it like so:
My Link
The reason to use the g.resource tag is it guarantees a correct link to the file. If you just hard code the file like href="somefile.html", then is is a relative path. If you are at the URI myapp/controller/action/foo, it will look for the file under myapp/controller/action/somefile.html.
Note: If you are using the cached-resources plugin or something similar, you will find the output URL is not actually myapp/somefile.html. The file is still accessible from that location, but the generated links will point to a static URL instead.

Customizing google plus url default comment

Is it possible to add a comment by default when using google plus share link?
The url is the following
https://plusone.google.com/_/+1/confirm?hl=en&url=URL_TO_SHARE
I've trieid adding &message=MESSAGE but that didn't help. Also tried &comment and &text
Just to warn you, this is not an officially supported part of the Google+ platform. I strongly recommend that you use the +1 button to share content to Google+.
That being said, there is no paramater that you can set to specify the message. The closest you can get to this is to use schema.org, open graph or HTML meta elements to specify the description of your target URL just like the +Snippet for the +1 button.

Resources