POST /api/login
Requestsexample 1
Headers
Content-Type: application/vnd.api.v1+json
Body
{
  "email": "email@example.com",
  "password": "123456789"
}
Responses200401
Headers
Content-Type: application/json
Body

{
  "data":
    {
      "token": "eyJ0eXAiOiJKV1QiLCJhbGciO...."
    }
}

Login
POST/api/login

This endpoint will allow you to login


GET /api/branches
Requestsexample 1
Headers
Content-Type: application/x-www-form-urlencoded
Responses200
Headers
Content-Type: application/json
Body

{
    "data": [
        {
            "id": 1,
            "name": "Branch 1",
            "address": "Lviv"
        },
        {
            "id": 2,
            "name": "Branch 2",
            "address": "Kiev"
        },
        {
            "id": 3,
            "name": "Branch 3",
            "address": "Odesa"
        }
    ],
    "meta": {
        "pagination": {
            "total": 3,
            "count": 3,
            "per_page": 50,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}
                                    
                                    

Branches
GET/api/branches

This endpoint will allow you to get all branches


GET /api/departments/{branch_id}
Requestsexample 1
Headers
Content-Type: application/x-www-form-urlencoded
Responses200
Headers
Content-Type: application/json
Body

{
    "data": [
        {
            "department_id": 1,
            "branch_id": 1,
            "branch_name": "Branch 1",
            "branch_address": "Lviv",
            "department_name": "Department 1"
        },
        {
            "department_id": 2,
            "branch_id": 1,
            "branch_name": "Branch 1",
            "branch_address": "Lviv",
            "department_name": "Department 2"
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 15,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Departments
GET/api/departments/{branch_id}

This endpoint will allow you to get all departments by branch


GET /api/metrics
Requestsexample 1
Headers
Content-Type: application/x-www-form-urlencoded
Responses200
Headers
Content-Type: application/json
Body

{
    "data": [
        {
            "id": 1,
            "type": "kilogram"
        },
        {
            "id": 2,
            "type": "pieace"
        },
        {
            "id": 3,
            "type": "gram"
        }
    ],
    "meta": {
        "pagination": {
            "total": 3,
            "count": 3,
            "per_page": 15,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Metrics
GET/api/metrics

This endpoint will allow you to get all metric types


GET /api/products/{branch_id}/{department_id}
Requestsexample 1
Headers
Content-Type: application/x-www-form-urlencoded
Responses200
Headers
Content-Type: application/json
Body

{
    "data": [
        {
            "product_id": 5,
            "product_sku": "12345",
            "product_name": "Product 4",
            "product_description": "Product description",
            "product_quantity": "3",
            "branch_id": 2,
            "branch_name": "Branch 2",
            "branch_address": "Kiev",
            "department_id": 3,
            "department_name": "Department 3",
            "metric_type": "kilogram"
        },
        {
            "product_id": 6,
            "product_sku": "12345",
            "product_name": "Product 5",
            "product_description": "Product description",
            "product_quantity": "2",
            "branch_id": 2,
            "branch_name": "Branch 2",
            "branch_address": "Kiev",
            "department_id": 3,
            "department_name": "Department 3",
            "metric_type": "kilogram"
        }
    ],
    "meta": {
        "pagination": {
            "total": 3,
            "count": 3,
            "per_page": 15,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Products
GET/api/products/{branch_id}/{department_id}

This endpoint will allow you to get all products by branch id and department id


GET /api/orders/{branch_id}
Requestsexample 1
Headers
Content-Type: application/x-www-form-urlencoded
Responses200
Headers
Content-Type: application/json
Body

{
    "data": [
        {
            "id": 1,
            "order_number": "12345",
            "status": "done",
            "products": [
                {
                    "product_id": 1,
                    "product_sku": "12345",
                    "product_name": "Product 1",
                    "product_description": "Product description",
                    "product_quantity": "1",
                    "department_name": "Department 1",
                    "metric_type": "kilogram"
                },
                {
                    "product_id": 1,
                    "product_sku": "12345",
                    "product_name": "Product 1",
                    "product_description": "Product description",
                    "product_quantity": "2",
                    "department_name": "Department 1",
                    "metric_type": "kilogram"
                }
            ]
        }
    ],
    "meta": {
        "pagination": {
            "total": 1,
            "count": 1,
            "per_page": 15,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Orders
GET/api/orders/{branch_id}

This endpoint will allow you to get all orders by branch id


GET /api/orders/{branch_id}/statuses
Requestsexample 1
Headers
Content-Type: application/x-www-form-urlencoded
Responses200
Headers
Content-Type: application/json
Body

{
    "data": [
        {
            "id": 1,
            "order_number": "12345",
            "status": "done"
        }
    ],
    "meta": {
        "pagination": {
            "total": 1,
            "count": 1,
            "per_page": 15,
            "current_page": 1,
            "total_pages": 1,
            "links": []
        }
    }
}

Orders with statuses
GET/api/orders/{branch_id}/statuses

This endpoint will allow you to get all orders only with status by branch id


POST /api/orders
Requestsexample 1
Headers
Content-Type: application/vnd.api.v1+json
Body

{
    "branch_id": 1,
    "products": [
        {
            "product_id": 1,
            "qty": 3
        },
        {
            "product_id": 3,
            "qty": 3
        }
    ]
}
                                    
Responses200
Headers
Content-Type: application/json
Body

{
    "data": {
        "id": 2,
        "order_number": 12346,
        "status": "new",
        "products": [
            {
                "product_id": 1,
                "product_sku": "12345",
                "product_name": "Product 1",
                "product_description": "Product description",
                "product_quantity": "3",
                "department_name": "Department 1",
                "metric_type": "kilogram"
            },
            {
                "product_id": 3,
                "product_sku": "12345",
                "product_name": "Product 2",
                "product_description": "Product description",
                "product_quantity": "3",
                "department_name": "Department 1",
                "metric_type": "piece"
            }
        ]
    }
}

Create order
POST/api/orders

This endpoint will allow you to create order


PATCH /api/orders/{id}
Requestsexample 1
Headers
Content-Type: application/vnd.api.v1+json
Body

ENUM ['new', 'todo', 'inprogress', 'done', 'archived']


{
	"status": "todo"
}
                                    
Responses200
Headers
Content-Type: application/json
Body

{
    "data": {
        "id": 2,
        "order_number": 12346,
        "status": "todo",
        "products": [
            {
                "product_id": 1,
                "product_sku": "12345",
                "product_name": "Product 1",
                "product_description": "Product description",
                "product_quantity": "3",
                "department_name": "Department 1",
                "metric_type": "kilogram"
            },
            {
                "product_id": 3,
                "product_sku": "12345",
                "product_name": "Product 2",
                "product_description": "Product description",
                "product_quantity": "3",
                "department_name": "Department 1",
                "metric_type": "piece"
            }
        ]
    }
}

Update order (status)
PATCH/api/orders/{order_id}

This endpoint will allow you to update order status