HTTP Request and Google API

Post Reply
cedric.sintes
Newbie
Posts: 13
Joined: Fri Feb 15, 2013 4:38 pm

HTTP Request and Google API

Post by cedric.sintes »

Hello Switch Users,

I need to send some metadata to a google sheet (and also create events in calendar). The goal is to monitor the progress of jobs and scheduling jobs into printer's calendar.
I think use HTTP request to connect to Google API, create and update Google Sheet with JobId, Customer Name, Delivery Date, ... and create an event in the printer's calendar with metadata (theorical time of event is a calculation of printing surface).

Did someone already connect Switch with Google API ? I have some problems with authentification...

https://developers.google.com/sheets/api/
https://developers.google.com/google-apps/calendar/

Thanks for help.
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: HTTP Request and Google API

Post by Padawan »

I've experimented with 3 legged OAuth before, but I'm far from an expert in it.

Technically, the App had to open a webpage for the user where he could allow the App to access the information of his account, then the API redirected to an URL of the app creator choice with parameters which had to be used as token by the app to be able to consume the API.

To my knowledge, that's all stuff which is not possible in Switch at the moment. Therefore I experimented with this tool:
https://code.google.com/archive/p/oacurl/

It's basically a minimal version of curl written in Java, but which handles the OAuth stuff for you. It was originally written to work with Google API's (although it is not limited to that), so it might be the tool you need.

I didn't create a Switch script with this tool yet, so you might run into issues I'm not aware of.

Edit: Also, I'm just assuming the API's you mention use 3 legged OAuth since the oacurl page mentions google uses this method in the past for authentication.
Post Reply