REST API Development Guide
Installation & Setup
Step one, sign up for a free account.
Within the Flybase Dashboard you can create, manage and delete Flybase apps. Clicking on a specific Flybase app lets you view and modify your app's data in realtime. In your app dashboard, you can also set Security, manage your app's authentication, deploys, and view analytics.
HTTPS is required. Flybase only responds to encrypted traffic so that your data remains safe.
All URLs referenced in the documentation have the following base:
The Flybase REST API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
In order to access any data from the REST API, you must pass a header called
Calling the REST API without any actions in the URL will result in validating the API Key. You can also call the REST API with the following end point to validate the API key:
curl -H "X-Flybase-API-Key: 74c8062f-cd6f-4c07-8baf-b1h241496dec" https://api.flybase.io/
curl -H "X-Flybase-API-Key: 74c8062f-cd6f-4c07-8baf-b1h241496dec" https://api.flybase.io/validate_key
An invalid API Key will result in not being able to do any other actions with the REST API. You can create new API Keys and add rules such as limiting access to apps or whitelisting access only to specified IP addresses or websites from your account.
If you don't want to pass your API key every time then you can also pass a JSON web token.
This can be generated by passing the following POST query:
curl -X POST https://api.flybase.io/create-token/YOUR-API-KEY
This will return a JSON object with
id_result as the key, copy the contents of
id_result to use elsewhere.
Then you can pass the JSON token rather than your API key via one of three ways:
1. Replace the api key with
curl -H "X-Flybase-API-Key: token:MYTOKEN" https://api.flybase.io/
2. Pass a
Authorization: Bearer header with your JWT token included after the word
curl -H "Authorization: Bearer MYTOKEN https://api.flybase.io/
3. Pass the token with the
jwttoken query string variable:
Either of these three methods work and provide a handy way to pass your api keys without actually passing your keys.
To get a list of collections in the specified app:
curl -H "X-Flybase-API-Key: 74c8062f-cd6f-4c07-8baf-b1h241496dec" https://api.flybase.io/apps/MY-APP/collections
To create a new collection, just start using it! Collections are created implicitly just by using them. As soon as you POST your first document you should see the collection appear.
That's it! Now we're ready to start reading and writing data to Flybase which we'll cover in the next section.