gas-rest

Translator of REST requests to build RESTful API using Google Apps Script

gas-rest

Translator of REST requests to build RESTful API using Google Apps Script

Why

To build RESTful backend for frontend development for 5 minutes

Overview

Route Verb Description
/api/:script_id Get Get all items from getSheets()[0]
/api/:script_id Post Create item on getSheets()[0]
/api/:script_id/:sheet_name Get Get all items from getSheetByName(:sheet_name)
/api/:script_id/:sheet_name Post Create item on getSheetByName(:sheet_name)
/api/:script_id/:sheet_name/:item_id Get Get single item from getSheetByName(:sheet_name)
/api/:script_id/:sheet_name/:item_id Post/Put Update item on getSheetByName(:sheet_name)
/api/:script_id/:sheet_name/:item_id Delete Delete item on getSheetByName(:sheet_name)

Profit

For example we have collection of cats:

ScreenShot

And we have a script like this one, which has been deployed as a web app with ID AKfycbwEw9l-DeT3Qfv5CmRm60k0RALu2iVIyvyAuaWZbHp2we7xi1E

Now we can: - get all cats:

ScreenShot

  • create new cat:

ScreenShot

ScreenShot

  • update a cat:

ScreenShot

ScreenShot

  • get cat by id:

ScreenShot

  • delete a cat:

ScreenShot

ScreenShot

How to

ScreenShot

ScreenShot

  • open script editor

ScreenShot

  • paste your tables ID

ScreenShot

  • run function doGet once to authorize script

ScreenShot

ScreenShot

ScreenShot

  • disregard the error message

ScreenShot

  • save new version of script

ScreenShot

ScreenShot

  • deploy script as web app

ScreenShot

ScreenShot

ScreenShot

Now you can build app which is consuming data via RESTful API

Related Repositories

gas-rest

gas-rest

Translator of REST requests to build RESTful API using Google Apps Script ...

gas-rest-angular

gas-rest-angular

GAS-REST Service Example App on AngularJS + Google Apps Script ...

gas-rest-ember

gas-rest-ember

GAS-REST Service Example App on Ember.js + Google Apps Script ...


Top Contributors

dab00