SQLiteDB. KVS DatabasesThe KVS (Key Value Store) databases contain key-value pairs.These are convenient in cases when SQL might feel too much. For instance: settings, options, lists
The keys are split by buckets. This allows keys to be easily grouped. Each bucket is stored in a separate table in the database.
API URLThe API URL is individual for each database and can be found on the user dashboard. Usually it will look something like this: http://sqlitedb.com/api/20180630065856012301
API Parameters
Parameter
| Is it Required?
| Description
| api_key
| required
| This is the API Key for accessing the database. Can be found in the user dashbard
| bucket
| required
| This is the bucket under which the key value pair is stored. If the bucket does not exist, it is created at runtime. The bucket name must consist only of lowercase letters (a-z) and underscore (_). Example valid bucket names: users, user_emails, latest_mobile_phones
| key
| required
| The key name. There is no maximum length, but its a good practice to keep these under 255 characters.
| value
| required (sometimes)
| The text value to be stored against the key. Text blobs (JSON, XML, HTML, base64 encoded binary data) can be used. Setting the value to null deletes the key
Required when creating/updating/deleting a key Not required when retrieving the key value
|
API ResponseThe API will respond with a JSON string with the following attributes.
Attribute
| Is it Always Send?
| Description
| status
| always
| Describes whether the request was successful or not. Possible values: error or success
| message
| always
| A short free text message with description of the action taken
| data
| always
| An array with variable data depending on the SQL query executed
|
Example API response:
{"status":"error","message":"API Key is invalid","data":[]}
Examples
- Create/update a key:https://sqlitedb.com/api/20180630065856012301?api_key=APIKEY&bucket=BUCKETNAME&key=MYKEY&value=MYVALUE
API response
{"status":"success","message":"key set successfully","data":{"key":"MYKEY","value":"MYVALUE"}}
- Retrieve a key valuehttps://sqlitedb.com/api/20180630065856012301?api_key=APIKEY&bucket=BUCKETNAME&key=MYKEY
API response
{"status":"success","message":"key found","data":{"key":"MYKEY","value":"MYKEY"}}
- Delete a keyhttps://sqlitedb.com/api/20180630065856012301?api_key=APIKEY&bucket=BUCKETNAME&key=MYKEY&value=null
API response
{"status":"success","message":"key removed successfully","data":{"key":"MYKEY"}}
|