Database
Action
Perform a get, set, or delete on a named JSON database belonging to your app. Data is shared across all users of the app — no user token required.
POST
/api/database/action.php
Requires
Authorization: AppID:AppKey — no user token neededRequest body
| Field | Type | Required | Description |
|---|---|---|---|
| action | string | required | "get", "set", or "delete" |
| name | string | required | Database name (e.g. "leaderboard") |
| path | string | optional | Slash-separated path within the JSON (e.g. "top1/score"). Only for get. |
| data | any | required for set | JSON value to store — object, array, string, or number |
Test this endpoint
Headers
Body
Response — action: get 200
{
"success": true,
"name": "leaderboard",
"path": null,
"data": {
"top1": { "user": "Vanelton", "score": 9999 },
"top2": { "user": "Maria", "score": 8500 }
}
}
Response — action: get with path 200
{ "success": true, "name": "leaderboard", "path": "top1/score", "data": 9999 }
Response — action: set 200
{ "success": true, "message": "Database saved successfully.", "name": "leaderboard" }
Response — action: delete 200
{ "success": true, "message": "Database deleted successfully.", "name": "leaderboard" }
Errors
| Code | Message | Cause |
|---|---|---|
| 401 | Authorization header with appid:appkey is required. | Missing header |
| 401 | Invalid app credentials. | Wrong AppID or AppKey |
| 400 | Missing required fields. | action or name not provided |
| 400 | Invalid action. | action is not get/set/delete |
| 404 | Data not found for the specified name and path. | Name doesn't exist or path not found |