Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
246 lines (231 sloc) 7.81 KB

Sheets-as-a-Service (SaaS)

Table Of Contents

  1. Description
  2. First Step To Use Service
  3. Required API Headers
  4. Operations
  5. Retrieve All Headers
  6. Retrieve Data Entry By UUID
  7. Create Data Entry
  8. Create Multiple Data Entries in Single REST Call
  9. Update Data Entry By UUID
  10. (Hard) Delete Data Entry By UUID
  11. Swagger API Documentation
  12. Contributions/Donations

Description

Quick way to add a cloud datasource into your personal or Enterprise application, with the power of Google Sheets. Sheets-as-a-Service provides REST endpoints to manipulate data in your spreadsheet.
Keep in mind, the URL for each operations is a BETA version. When the official version is released, the test host will be disabled.

First Step to Use Service

In order to use Sheets-as-a-Service, you must give the application read/write access to your Google sheets. To do so, follow the 2 simple steps below.

  1. In your spreadsheet, click on Share
  2. Under Share with others, enter in this application email address: sheets-as-a-service@sheets-as-a-service-234316.iam.gserviceaccount.com. Once you have done so, now you should be able to manipulate your spreadsheet data through the API.

Required API Header

  1. Spreadsheet-ID

Operations

Retrieve All Headers

Retrieve all headers from Google Sheets. A header is equivalent to the key value of the JSON request object.

Request

GET: https://sheets-as-a-service.cfapps.io/sheets/headers

Response

Response: 200 OK

[
    "id",
    "firstName",
    "lastName",
    "city",
    "postalCode",
    "state",
    "line2",
    "age",
    "line1"
]


Retrieve Data Entry By UUID

Retrieve a data entry from Google Sheets by UUID. Google Sheets data will be restructured into a JSON response.

Request

GET: https://sheets-as-a-service.cfapps.io/sheets/cfb04416-5bfd-4ad9-8e85-b78c82e8f659

Response

Response: 200 OK

{
    "firstName": "John",
    "lastName": "Doe",
    "city": "Saint Louis",
    "postalCode": "12442",
    "id": "cfb04416-5bfd-4ad9-8e85-b78c82e8f659",
    "state": "MO",
    "line2": "Apartment B",
    "age": "45",
    "line1": "123 Main Street"
}


Create Data Entry

Create data entry into Google Sheets. JSON request object will be transformed into Google Sheets row.

Request

POST: https://sheets-as-a-service.cfapps.io/sheets

Request Body:

{
    "firstName": "John",
    "lastName": "Doe",
    "city": "Saint Louis",
    "postalCode": "12442",
    "state": "MO",
    "line2": "Apartment B",
    "age": "45",
    "line1": "123 Main Street"
}

Response

Response: 200 OK

{
    "firstName": "John",
    "lastName": "Doe",
    "city": "Saint Louis",
    "postalCode": "12442",
    "id": "937bf940-7d73-4250-9351-0dc5acd5e8ef",
    "state": "MO",
    "line2": "Apartment B",
    "age": "45",
    "line1": "123 Main Street"
}


Create Multiple Data Entries in Single REST Call

Create multiple data entries into Google Sheets with a single REST call. Request will be a JSON array, which will then be transformed into Google Sheets rows.

Request

POST: https://sheets-as-a-service.cfapps.io/sheets/multiple

Request Body:

[
	{
		"firstName": "John",
		"lastName": "Doe",
		"age": 45,
		"line1": "123 Main Street",
		"line2": "Apartment B",
		"city": "Saint Louis",
		"state": "MO",
		"postalCode": "12442"
	},
	{
		"firstName": "Jane",
		"lastName": "Smith",
		"age": 28,
		"line1": "999 Jefferson Street",
		"line2": "Apartment 2",
		"city": "Chicago",
		"state": "IL",
		"postalCode": "55493"
	},
	{
		"firstName": "Robert",
		"lastName": "Jones",
		"age": 34,
		"line1": "776 Manchester Avenue",
		"city": "Los Angeles",
		"state": "CA",
		"postalCode": "33482"
	}
]

Response

Response: 200 OK

[
    {
        "firstName": "John",
        "lastName": "Doe",
        "city": "Saint Louis",
        "postalCode": "12442",
        "id": "cfb04416-5bfd-4ad9-8e85-b78c82e8f659",
        "state": "MO",
        "line2": "Apartment B",
        "age": "45",
        "line1": "123 Main Street"
    },
    {
        "firstName": "Jane",
        "lastName": "Smith",
        "city": "Chicago",
        "postalCode": "55493",
        "id": "9e07a19e-337a-4913-a759-fd5db27d26bc",
        "state": "IL",
        "line2": "Apartment 2",
        "age": "28",
        "line1": "999 Jefferson Street"
    },
    {
        "firstName": "Robert",
        "lastName": "Jones",
        "city": "Los Angeles",
        "postalCode": "33482",
        "id": "b698de21-e452-4b96-b7ab-51e30140acb2",
        "state": "CA",
        "line2": "",
        "age": "34",
        "line1": "776 Manchester Avenue"
    }
]


Update Data Entry By UUID

Update data entry in Google Sheets by UUID.

Request

PUT: https://sheets-as-a-service.cfapps.io/sheets/937bf940-7d73-4250-9351-0dc5acd5e8ef

Request Body:

{
    "firstName": "UPDATE",
    "lastName": "UPDATE",
    "age": 45,
    "line1": "UPDATE",
    "line2": "UPDATE",
    "city": "UPDATE",
    "state": "UPDATE",
    "postalCode": "UPDATE"
}

Response

Response: 200 OK

{
    "firstName": "UPDATE",
    "lastName": "UPDATE",
    "city": "UPDATE",
    "postalCode": "UPDATE",
    "id": "937bf940-7d73-4250-9351-0dc5acd5e8ef",
    "state": "UPDATE",
    "line2": "UPDATE",
    "age": "45",
    "line1": "UPDATE"
}


(Hard) Delete Data Entry By UUID

Purge data from Google Sheets by UUID. This endpoint will permanently remove the entry row from Google Sheets.

Request

Delete: https://sheets-as-a-service.cfapps.io/sheets/937bf940-7d73-4250-9351-0dc5acd5e8ef

Response

Response: 200 OK


Swagger API Documentation

  1. https://sheets-as-a-service.cfapps.io/swagger-ui.html
  2. https://sheets-as-a-service.cfapps.io/v2/api-docs

Contributions/Donations

Sheets-as-a-Service will be FREE to use for personal/enterprise projects, however you please. Donations to this project is always welcome, and much appreciated! Please support us to keep this ongoing, and future enhancements.

You can’t perform that action at this time.