A beautiful API which provides an opportunity for a user to send their request about price delivery of their parcel to the Tiny Parcel.
The enquire will then get estimated with the highest best quote and persisted in the DB for further accessing by its ID.
- PostgreSQL relational database
- Symfony 5 php framework
- Composer dependency manager
- Doctrine ORM
- PHPUnit testing framework
- Monolog logger
- Postman testing API tool
git clone git@github.com:AliceMakk/tiny_parcel.git
- Run local instance of PostgreSQL and update credentials exposed in global DATABASE_URL in .env
- Add vendor dependencies
composer i
- Create needed tables in the DB
php bin/console doctrine:migrations:migrate
- Seed the DB with dummy pricing model and user
php bin/console doctrine:fixtures:load
- Run server
symfony server:start
via Symfony-CLI
Required header for each request:
X-AUTH-TOKEN: _WvpbpJOns9ZxdOIuxWMTsFFj0AdZY0KubskvSUhIb0
Example of response:
{"id":396,"name":"Tiny box","weight":"0.40","declaredValue":1300,"volume":"0.0007900","quote":"39.00","price_model":"value"}
Example of request:
{
"name" : "Little phone",
"weight" : "0.5",
"volume" : "0.0005",
"declared_value" : "500"
}
Example of response:
{"status":"Parcel saved!","id":1}
Example of request:
{
"name" : "Expensive Sumsung tv",
"weight" : "20",
"volume" : "2",
"declared_value" : "5000"
}
Example of response:
{"status":"Parcel updated!","id":1}
Example of response:
{"status":"Parcel deleted!"}
Example of response:
[{"parcelId":399,"quote":"$39.00"},{"parcelId":400,"quote":"$100.00"}]