E-commerce



Preparing the project

Installing dependencies

This project utilizes a couple of third-party laravel packages, those packages are listed below corresponding to thier installation commands.

Package Name URL Installation Command
Stancl/Tenancy Tenancy for laravel composer require stancl/tenancy
Tymon/JWT-Auth jwt-auth composer require tymon/jwt-auth

Generating Authentication Secret Key

php artisan jwt:secret

Migrating The Database

php artisan migrate

Seeding The Database

php artisan db:seed


Response Structure

All responses returned from the documented API are following the same following schema

{
  "status": "boolean",
  "data": "any",
  "error": "Error|null"
}

the value of the data field differs according to the requested resource, while the value of the error field is either null - in case of success, or an Error object as described below

{
  "message": "string",
  "code": "integer",
  "details": "array"
}

the details field holds an extra details about the error - optionally provided at development - and will only be visible if the debug is enabled.

For full requests & response reference, see schema.



Available Requests

If you are using Postman to discover this API, you may need this

Request Group Request Name HTTP Method URL Allowed For
Merchants Signup Merchant POST api/merchants/register World
Merchants Authenticate Merchant POST api/merchants/login World
Consumers Signup Consumer POST api/consumers/register World
Consumers Authenticate Consumer POST api/consumers/login World
Stores Update Store PUT api/stores/{storeId} Merchant
Products Get All Products GET api/stores/{storeId}/products World 1
Products Create Product POST api/stores/{storeId}/products Merchant
Products Update Product PUT api/stores/{storeId}/products Merchant


Known Issues

  • All tenants databases are hosted together.


Top   -   Response Structure   -   Available Requests

Footnotes

  1. Merchants allowed only for their stores.