JSON Dummy Data API is a FastAPI application that generates JSON data based on a provided format using any model from Github's Marketplace. The application exposes an endpoint to generate a list of JSON objects with dummy data.
- Python 3.9+
- Docker (optional, for containerized deployment)
- Github Personal Token as enviroment variable named:
GITHUB_TOKEN
-
Clone the repository:
git clone https://github.com/cavp28/JSON-dummy-data-API.git cd JSON-dummy-data-API -
Create and active a virutal enviroment:
python -m venv env source env/bin/activate # On Windows use `env\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up your environment variables:
export GITHUB_TOKEN=your_github_token
- Start the FastAPI served:
fastapi dev main.py- Access the API Documentation at
http://127.0.0.1:8000/docs
- Build the Docker image:
docker-compose build- Run the Docker container with docker compose:
docker-compose upHere are some examples of how to use the TellMeSomething project:
Generates a list of JSON objects with dummy data based on the provided format.
max_rows(optional, default: 10): The number of JSON objects to generate.details(optional, default: ""): Additional details or instruct- A JSON object specifying the format of the data.
{"key_name": "data_type"}
- Testing APIs: Generate dummy data to test your APIs without manually creating JSON objects.
- Prototyping: Quickly generate sample data for prototyping and development.
- Data Validation: Ensure that your application can handle various data formats and structures.
POST /generate_json
Content-Type: application/json
{
"name": "string",
"age": "integer",
"email": "string"
}[
{
"name": "John Doe",
"age": 30,
"email": "john.doe@example.com"
},
{
"name": "Jane Smith",
"age": 25,
"email": "jane.smith@example.com"
},
...
]# POST /generate_json?max_rows=5
# Content-Type: application/json
{
"username": "string",
"password": "string",
"email": "string"
}[
{
"username": "user1",
"password": "pass1",
"email": "user1@example.com"
},
{
"username": "user2",
"password": "pass2",
"email": "user2@example.com"
},
...
]POST '/generate_json?max_rows=3&details=Include+product+descriptions' \
--header 'Content-Type: application/json' \
--data '{
"product_name": "string",
"price": "float",
"description": "string"
}'[
{
"product_name": "Product A",
"price": 19.99,
"description": "A high-quality product."
},
{
"product_name": "Product B",
"price": 29.99,
"description": "An excellent choice for your needs."
},
...
]POST '/generate_json?max_rows=5&details=names%20must%20be%20from%20latin%20america' \
--header 'Content-Type: application/json' \
--data '{
"full_name": "string",
"country": "string",
"birth_date": "date",
"is_alive": "boolean",
"money": "int",
"interest_rate": "float"
}'[
{
"full_name": "José Luis Pérez",
"country": "Mexico",
"birth_date": "1985-06-15",
"is_alive": true,
"money": 25000,
"interest_rate": 3.5
},
{
"full_name": "María Fernanda Gómez",
"country": "Colombia",
"birth_date": "1990-03-22",
"is_alive": true,
"money": 15000,
"interest_rate": 4.0
},
{
"full_name": "Carlos Alberto Sánchez",
"country": "Argentina",
"birth_date": "1978-11-05",
"is_alive": false,
"money": 5000,
"interest_rate": 2.1
},
{
"full_name": "Lucía Martínez",
"country": "Chile",
"birth_date": "1992-08-10",
"is_alive": true,
"money": 30000,
"interest_rate": 3.8
},
{
"full_name": "Andrés Felipe Torres",
"country": "Peru",
"birth_date": "1980-04-30",
"is_alive": false,
"money": 7000,
"interest_rate": 2.5
}
]Contributions are welcome! Please open an issue or submit a pull request.