API - Mohamed-Ashour/Laravel-eCommerce-API GitHub Wiki
This is how you can use the API:
-
To register a user send request:
Posthttp://localhost:8000/api/register
with name, email and password as parameters -
To login a user send request:
Posthttp://localhost:8000/api/login
with email and password as parameters
If the email and password are correct you will receive json web token.
you should save it to use it in the next requests.
To make authenticated requests via http, you will need to set an authorization header as follows:
Authorization: Bearer {user_web_token}
Alternatively you can include the token via a query string, for example:
http://localhost:8000/api/authenticate?token={user_web_token}
-
To get the logged in user details send request:
Gethttp://localhost:8000/api/authenticate
-
To list all products in latest order send request:
Gethttp://localhost:8000/api/products
-
To list all categories send request:
Gethttp://localhost:8000/api/categories
-
To list all products in specific category send request:
Gethttp://localhost:8000/api/categories/{category_id}