Skip to content

Latest commit

 

History

History
325 lines (214 loc) · 7.22 KB

README.md

File metadata and controls

325 lines (214 loc) · 7.22 KB

API Reference

Below you can see the endpoints in this backend project.

Only endpoints and their parameters are specified in this reference. You can try the API to see the results returned.


Contents of this file

Route Service
access Access sharing
auth Authentication
orders Scheduled orders
products Product inventory
verification Email verification



Access sharing endpoints

URL generating

Decodes the given JWT token and generates a URL for the user to share access with.

POST /access/generate-url
Parameter Description Required
jwt JWT Token true

Receive access

Adds the ID resolved from JWT to the users who have permission to access the inventory of the user with the ID value specified as the parameter.

POST /access/receive
Parameter Description Required
jwt JWT Token true
id The ID of the user who is sharing the access true

View shared

Lists the permissions that the current user shares with other users.

POST /access/view-shared
Parameter Description Required
jwt JWT Token true

View received

Lists the permissions that other users have shared with the current user.

POST /access/view-received
Parameter Description Required
jwt JWT Token true

Revoke shared

Allows the current user to revoke the permissions that other users have shared with them.

POST /access/revoke-shared
Parameter Description Required
jwt JWT Token true
id ID of the user whose shared access is being revoked true

Revoke received

Allows the current user to revoke the access permission shared by another user.

POST /access/revoke-received
Parameter Description Required
jwt JWT Token true
id ID of the user whose received access is being revoked true




Authentication endpoints

Login

Returns a JWT token to log in with the given credentials.

POST /auth/login
Parameter Description Required
user Email or username true
password Password true

Register

Creates a new user record with the provided credentials. The /verification endpoint is used to activate the user created in this endpoint.

POST /auth/register
Parameter Description Required
username Username true
email Email true
password Password true

Get credentials

Decrypts the given JWT token to return the user's credentials.

POST /auth/get-credentials
Parameter Description Required
jwt JWT token true




Order endpoints

Get order

Lists all scheduled orders that the user has access to.

POST /orders/get
Parameter Description Required
jwt JWT Token true
order_id Order ID false

Create order

Creates a new scheduled order.

POST /orders/create
Parameter Description Required
jwt JWT Token true
order Order data true

Update order

Updates a scheduled order.

POST /orders/update
Parameter Description Required
jwt JWT Token true
order_id Order ID true
updated_order Updated order data true

Delete order

Delete a scheduled order.

POST /orders/delete
Parameter Description Required
jwt JWT Token true
order_id Order ID true




Product endpoints

Get product

Lists all products that the user has access to.

POST /products/get
Parameter Description Required
jwt JWT Token true
product_id Product ID false

Create product

Creates a new product.

POST /products/create
Parameter Description Required
jwt JWT Token true
product Product data true

Update product

Updates a product.

POST /products/update
Parameter Description Required
jwt JWT Token true
product_id Product ID true
updated_product Updated product data true

Delete product

Delete a product.

POST /products/delete
Parameter Description Required
jwt JWT Token true
product_id Product ID true




Verification endpoints

Send email

If there is a user with the given email address, sends a verification email to that email address. The sent email contains a verification key and must be used in the /verification/verify-email endpoint.

GET /verification/send-email
Parameter Description Required
email Email address true

Verify email

Checks if the given key matches the key generated at the /verification/send-email endpoint, and if so, it activates the user's status.

GET /verification/verify-email
Parameter Description Required
key Verification key true

Check verification

Checks whether the user with the given email address is verified.

GET /verification/is-verified
Parameter Description Required
email Email address true