Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andraxdev/json-database-api
A simple JSON database API that allows you to create, read, update and delete data from a JSON file.
https://github.com/andraxdev/json-database-api
api database docker flask json nosql python
Last synced: 16 days ago
JSON representation
A simple JSON database API that allows you to create, read, update and delete data from a JSON file.
- Host: GitHub
- URL: https://github.com/andraxdev/json-database-api
- Owner: AndraxDev
- Created: 2024-03-15T11:33:42.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-16T12:04:58.000Z (8 months ago)
- Last Synced: 2024-10-15T03:54:35.215Z (about 1 month ago)
- Topics: api, database, docker, flask, json, nosql, python
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON Database API
## Introduction
This is a simple JSON database API that allows you to create, read, update and delete data from a JSON file.
## Installation
```bash
pip install -r requirements.txt
```## Usage
```bash
flask run
```## Endpoints
### GET /api/v1/read
This endpoint returns all the data from the JSON file.
### GET /api/v1/write
This endpoint allows you to write data to the JSON file. If key already exists, it will be updated.
### GET /api/v1/delete
This endpoint allows you to delete data from the JSON file.
## Params
***path*** - The path to the JSON value. Example: `path=users/0/name` will return data at `users[0]['name']` in the JSON file `{"users": {"0": {"name": {}}}}`.
***value*** - The value to write to the JSON file. Example: `value=John` will write `John` to the JSON file. JSON strings are supported.
***type*** - The type of the value to write to the JSON file. Example: `type=string` will write `John` as a string to the JSON file. Supported types: `string`, `json`, `float`, `bool`, `null`. If `type` is not provided, the value will be written as a JSON. If `null` is provided, the value will be deleted from the JSON file.
## Example
```bash
curl -X GET "http://localhost:5000/api/v1/read?path=users/0/name"
```will return
```json
{
"value": "John"
}
```## License
```angular2html
Copyright (c) 2024 Dmytro Ostapenko. All rights reserved.Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```