Oursky Code
  • AI
  • Auth
  • More from Oursky
    • Oursky Business Blog
    • GitHub
    • About Us
  • AI
  • Auth
  • More from Oursky
0
Subscribe
Oursky Code
Oursky Code
  • AI
  • Auth
  • More from Oursky
    • Oursky Business Blog
    • GitHub
    • About Us
  • Opensource

A spreadsheet-based API for building MVPs.

  • July 20, 2017
  • No comments
  • 4 minute read
  • David Ng
Photo by Dimitri Tyan via Unsplash
Total
0
Shares
0
0
0

What do you do if you have a site you want to update once in a while? It’s not a blog, so you don’t want WordPress. It’s also not worth building a customized backend. In developer-speak, we would think about a remote data hosting to store the data for semi-dynamic websites or applications.

So we made a free open source tool APITable for that, which converts tables to JSON API.

Take a look at the below Notice app — you will want to centralize your information somewhere in cloud storage so that you can update and synchronize to all client apps (be it websites / mobile apps).

The default solution might be hosting on your own server with Django or Node.js to serve as an endpoint for providing an API. But doesn’t that sound a bit overkill?

Imagine a WordPress for applications

It’d be nice if there is something similar to WordPress that can be used as a CMS (Content Management System) for your application — something with a simple GUI for editing and the backend is updated for you.

Why can’t it be simple and user-friendly?

Rather than setting up a dedicated server for an API endpoint for some relatively static data, there are some easier choices:

  1. Hosting a static JSON file at S3;
  2. Using a mock API service to mock an endpoint

However, it requires extra development effort to update data from the endpoint.

Hence when we think about the question:

“What should the next generation of APIs be like?”

Why can’t the API data be just as intuitive as we view it? Our solution was an APITable which does one thing: Table → JSON API

Data in tabular form (left) is converted to a JSON endpoint (right)

There are several reasons we believe APITable can do the right job as a simple API endpoint:

No need to learn about databases

Database knowledge is basic for developers, but it might not be that obvious to those who want to update the data. The table view encapsulates complex operations such defining schema and writing raw queries. The data editor can manage useful information directly instead of dealing with the technical part of the API endpoint.

Instant API

No deployment needed. One you’ve updated the table, the data will be available to your API clients instantly. You can also add / drop columns directly from the spreadsheet-like editor.

No SDK required

JSON API is developer friendly. Whether your front-end is a website, iOS or Android mobile app — you can find a neat parser to convert the API returned data to the data type you need.

You can also directly curl the API directly. You don’t need to stick to any SDK for this simple API service.

Edit data directly in tables

We love data in a tabular form for these reasons: You have a quick overview in a glance; what you edit is what you get — you do not need to navigate into sub-layers to edit the detail of a product, just do it directly in the table.

Once you update the price, the change will be reflected in the API.

Challenges

The spreadsheet library is powered by the Hansontable open source project, we can achieve rows and columns editing easily. Besides building the application UI, there are more technical challenges synchronizing the data worth sharing.

We have used Skygear.io as our application backend, which serves as the cloud database of our tables.

Save and load records in batches

Firstly, loading a big table from the cloud in a single query may induce a slow loading speed (we used the Hong Kong bus routes and fares dataset in testing, which has 1000+ rows of records). We also considered that API users might not need all data at the same time. Hence we introduced Pagination in both the spreadsheet and API endpoint.

There is also a performance problem when multiple rows are saved. Consider the case of copying and pasting data into the spreadsheet, which triggers a multi-row update. If we save row by row, it will take many requests to save all the record updates. Hence upon saving, there is a trick behind the scene:

  • Distinguish between whether a row is updated or deleted;
  • Each added row needs to be updated to a queue, and those to be deleted into another queue;
  • Save the update and delete queue in a batch.

After we packed the records together, only 2 requests are needed.

Simple authorization

You might not want your API to be exposed to everyone. We’ve also designed for people who needs authentication for the API — the more simple and effective way is to require a valid token when accessing the endpoint.

To manage who can access data from your table, you can create and revoke token at the APITable dashboard.

Creating or revoking a token for the API, you can create multiple tokens.

Who’s APITable made for?

It as originally designed for exposing APIs for simple mobile applications — but here are the other use cases we can think of:

  • Indie developers: fast prototyping for apps to demonstrate the ability of remote fetching for data;
  • Startups: building MVPs or simple newsfeed applications;
  • QA testers: storing data fixture or dummy data for app testing purpose.

APITable is a free, open-source project available on GitHub we made to help indie developers and even those who just need an handy API endpoint. Let us know what you think!

Read more from Oursky

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Related Topics
  • API
  • Startup
David Ng

Previous Article
  • React Native

How we restructured our app with React Navigation

  • June 23, 2017
  • YinYin Chiu
View Post
Next Article
  • Skygear
  • Software Testing

Catch bugs systematically: how to build a GitLab CI testing pipeline in 4 steps

  • August 15, 2017
  • Joyz Ng
View Post
You May Also Like
View Post
  • DevSecOps
  • Opensource
  • Security and Privacy

Kubernetes Security – Network Encryption between k8s Deployments and Ingress

  • September 4, 2020
  • Elliot Wong
oursky opensource github
View Post
  • Android
  • Opensource

An Opensourced Recipe for Intializing Redux x Android Native Apps

  • May 9, 2018
  • David Ng
discourse forum deployed on kubernetes k8s
View Post
  • Opensource

How to set up an internal team forum in half a day using Discourse

  • January 29, 2018
  • Ben Cheng
View Post
  • DevOps
  • Opensource

How I built a Kubernetes cluster so my coworkers could deploy apps faster

  • May 26, 2017
  • cheungpat
View Post
  • iOS
  • Opensource

Continuously Delivering iOS Beta Builds Automated with Travis CI

  • March 26, 2015
  • David Ng

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Subscribe Us

Join our mailing list to never miss an update!

Oursky Code Blog
A team of Developers, Designers and Geeks. All about hacking and building things.

Input your search keywords and press Enter.