Important
This API has been deprecated in favor of a new node API. There will be no further enhancements or modifications to this deprecated API.
This is a basic RESTful API designed for a customer.The API will allow you to fech information from a products and customers table in the databes and allow you to read,create and update them. Delete request is not allow at this time.
Despite of my frontend background, I wanted to create a basic Restapi in PHP using PHP Slim 4 framework to serve as backend on some of my projects.
You can download the project in zip format or clone with:
gh repo clone ajsevillano/api.uniondistribuidora.com
- Download and install composer from here
- Then install all the project's dependencies:
php composer.phar update
I will create a file with the database structure and some dummy data for testing in next releases.
The API will provived you some endpoints:
GET /products <- It will return a full json list of the products in the DB.
GET /products/id <- It will return an unique product based on its ID. Only
numerics IDs are allow.
GET /customers <- It will return a full json list of the customers in the DB.
GET /customers/id <- It will return an unique customer based on its ID. Only
numerics IDs are allow.
POST /products
You will need to send a json object to create a new item in the next format:
{
"tipo": "type of drink",
"marca": "Brand",
"tamano": "Size",
"nombre": "Name",
"activo": "0"
}
Put /products
You will need to send a json object to update an item based in its ID in the next format:
{
"id": "an numeric id",
"tipo": "beer",
"marca": "Brand",
"tamano": "Size",
"nombre": "Name",
"activo": "0"
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.