Understanding Data - REST API Development Guide - Helper Libraries - Developer Docs

REST API Development Guide

Understanding Data

How Data is Handled

Inside a Flybase app, we have collections, which contain data.

We store all data inside a collection as JSON objects. When we add a new record to a collection, it becomes a document in the existing JSON structure.

For example, if we added a column named furbies to the kaitlyn user under the users collection, our data looks as follows:


{
	"users": {
		{
			"_id": "uniquedocid-1",
			"username": "kaitlyn",
			"friends": { "jacob": true },
			"name": "Kaitlyn",
			"furbies": { "cocoa": true, "totoa": true }
		},
		{
			"_id": "uniquedocid-2",
			"username": "jacob",
			...
		},
		{
			"_id": "uniquedocid-3",
			"username": "caleb",
			...
		}
	}
}
		
Reference a Flybase app

To read and write Flybase data, we need to reference our app.

A Flybase reference consists of three items:

  1. Your API Key, represented by: 74k8064f-cd6f-4c07-8baf-b1d241496eec
  2. The slug of a Flybase app that has been created in your account: web
  3. Finally, the name of a data collection, in this example: posts

curl -X POST -d '{ "title": "The Black Pearl", "author": "jacks" }' \
  -H "X-Flybase-API-Key: 74k8064f-cd6f-4c07-8baf-b1d241496eec" \
  https://api.flybase.io/apps/web/collections/posts
		

Data inside a Flybase app is organized by collections, if you are familiar with SQL tables, then this is similar to tables.

Apps must be created inside your Flybase dashboard, but if you call a collection that does not exist already then it will get created the first time you save data to it.

Flybase provides a Dashboard, which displays a visual representation of the data and provides tools for simple administrative tasks.

That's it! Now we're ready to start writing data to Flybase which we'll cover in the next section.