Translator of REST requests to build RESTful API using Google Apps Script hosted on http://rest.daspot.ru
To build RESTful backend for frontend development for 5 minutes
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) |
For example we have collection of cats:
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:
- create new cat:
- update a cat:
- get cat by id:
- delete a cat:
-
open this table
-
make a copy
- open script editor
- paste your tables ID
- run function doGet once to authorize script
- disregard the error message
- save new version of script
- deploy script as web app
Now you can build app which is consuming data via RESTful API