https://github.com/rcasanovan/fakeproductsapi
A fake REST API for testing and development purposes.
https://github.com/rcasanovan/fakeproductsapi
api restapi typicode
Last synced: 4 months ago
JSON representation
A fake REST API for testing and development purposes.
- Host: GitHub
- URL: https://github.com/rcasanovan/fakeproductsapi
- Owner: rcasanovan
- License: apache-2.0
- Created: 2025-08-04T15:06:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-10T16:27:24.000Z (10 months ago)
- Last Synced: 2025-08-20T14:15:05.399Z (10 months ago)
- Topics: api, restapi, typicode
- Homepage:
- Size: 929 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fake Products API
A fake REST API for testing and development purposes, powered by [my-json-server.typicode.com](https://my-json-server.typicode.com).
## How It Works
This repository uses [my-json-server.typicode.com](https://my-json-server.typicode.com) to instantly create a fake REST API from the `db.json` file. No server setup required!
### API Endpoints
Once the repository is pushed to GitHub, you can access the API at:
- **Base URL**: `https://my-json-server.typicode.com/rcasanovan/fakeProductsAPI`
- **All Products**: `https://my-json-server.typicode.com/rcasanovan/fakeProductsAPI/products`
- **Single Product**: `https://my-json-server.typicode.com/rcasanovan/fakeProductsAPI/products/{id}`
### Available Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/products` | Get all products |
| GET | `/products/{id}` | Get a specific product by ID |
| GET | `/products?type={type}` | Filter products by type |
### Product Types
The API includes products in the following categories:
- **food**: Sandwiches, wraps, salads, pizza, etc.
- **drink**: Coffee, juice, soft drinks, energy drinks, etc.
- **dessert**: Chocolate bars, muffins, yogurt, cookies, etc.
- **snack**: Granola bars, peanuts, etc.
- **other**: Cheese & crackers, etc.
### Product Structure
Each product has the following properties:
```json
{
"id": 1,
"name": "Product Name",
"image": "https://raw.githubusercontent.com/rcasanovan/fakeProductsAPI/main/Images/image.jpg",
"price": 7.99,
"inventory": 20,
"type": "food"
}
```
## Usage Examples
### Get all products
```bash
curl https://my-json-server.typicode.com/rcasanovan/fakeProductsAPI/products
```
### Get a specific product
```bash
curl https://my-json-server.typicode.com/rcasanovan/fakeProductsAPI/products/1
```
### Filter by type
```bash
curl https://my-json-server.typicode.com/rcasanovan/fakeProductsAPI/products?type=drink
```
## About my-json-server.typicode.com
This service allows you to create instant fake REST APIs by simply:
1. Creating a GitHub repository
2. Adding a `db.json` file with your data
3. Accessing your API at `https://my-json-server.typicode.com/{username}/{repo}`
**Note**: Changes are faked and not persisted, requests are cached for 1 minute, and all servers are public.
## Repository Structure
```
fakeProductsAPI/
├── db.json # Main data file with products
├── Images/ # Product images
└── README.md # This file
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.