Product Pagination API
API related to the product pagination API.
Product Pagination API of Each API Endpoint ?
All the pagination API have been abbreviated with "/pg" at end of the url to differentiate the difference between using the pagination API.
How to use Example section ?
If the application is currently running and records are loaded into the database, clicking on an example will cause the web browser to open a new tab and render the API outcome.
An Example is shown here below.
Using Swagger API UI to test URL endpoints
Alternatively, to test the API endpoint u can turn on the Swagger API UI and test it directly with the application.
Get All Product using Pagination
GET
http://localhost:5000/product/pg
Get all the records with pagination queries which required to be passed. 1. required QUERY_PARAM {currentPage} -> specify the current page 2. required QUERY_PARAM {itemPerPage} -> specify the max item per page Available metadata required: (currentPage , itemPerPage, totalItems, totalPages) Returns a list of ProductDTO object for the current page selected.
Query Parameters
itemPerPage
number
specify max number of items per page -> (min: 10, max:50)
currentPage
number
specify which page to retrieve
Get All Products + Sorting with pagination
GET
http://localhost:5000/product/pg/sortby
Get all the records with pagination queries which required to be passed with optional sorting param query to be passed. ### Required Parameters ### 1. required QUERY_PARAM {currentPage} -> specify the current page 2. required QUERY_PARAM {itemPerPage} -> specify the max item per page Available metadata returned: (currentPage, itemPerPage, totalItems, totalPages) returns a list of ProductDTO object for the current page selected ### Optional Parameters ### 3. optional to pass {orderByName} -> if passed as PARAM_QUERY will sort based on possible values 4. optional to pass {orderByPrice} -> if passed as PARAM_QUERY will sort based on possible values 5. if multiple sort is specified, then it will be sorted by name then price. 6. if other values is provided to orderByName / orderByPrice, it will disregard the value and sort it in ascending order.
Query Parameters
itemPerPage
number
specify max number of items per page -> (min: 10, max:50)
currentPage
number
specify which page to retrieve
orderByPrice
string
Accepts
asc
sort by Ascending Order
desc
sort by Descending Order
orderByName
string
Accepts
asc
sort by Ascending Order
desc
sort by Descending Order
Get Products by filtering price + sorting with pagination
GET
http://localhost:5000/product/pg/filterByPrice
get products by filtering price (within min - max range) or (>= min) or (<= max) then sorting with pagination ### required Parameters ### 1. required QUERY_PARAM {currentPage} -> specify the current page 2. required QUERY_PARAM {itemPerPage} -> specify the max item per page Available metadata returned: (currentPage, itemPerPage, totalItems, totalPages) returns a list of ProductDTO object for the current page selected ### optional Parameters ### 3. {minprice} - OPTIONAL_PARAMETER, query will still work w/o min price input 4. {maxprice) - OPTIONAL_PARAMETER, query will still work w/o max price input 5. optional to pass {orderByName} -> query will still work w/o inputing min or max value 6. optional to pass {orderByPrice} -> query will still work w/o input min or max value 7. if multiple sort is specified, then it will be sorted by name then price. 8. if other values is provided to orderByName / orderByPrice, it will disregard the value and sort it in ascending order.
Query Parameters
itemPerPage
string
specify the max item per page (min: 10, max: 50)
currentPage
number
specify which page to retrieve
minprice
number
minimum price - cannot be less than 0
maxprice
number
max maximum price - cannot be more than 9999
orderByPrice
string
Accepts
asc
sort by Ascending Order
desc
sort by Descending Order
orderByName
string
Accepts
asc
sort by Ascending Order
desc
sort by Descending Order
Get Products by filtering name + sorting with pagination
GET
http://localhost:5000/product/pg/filterByName/{name}
get products by filtering name using the like clause + sorting 1. {name) - REQUIRED PARAMETER, query will search for name of product and returns the product name which has the text name in it 2. optional to pass {orderByName} -> query will still work w/o inputing min or max value 3. optional to pass {orderByPrice} -> query will still work w/o input min or max value 4. if multiple sort is specified, then it will be sorted by name then price. 5. if other values is provided to orderByName / orderByPrice , it will disregard the value and sort it in ascending order.
Path Parameters
name
string
name of the product -> will be filtered using like clause
Query Parameters
orderByPrice
string
Accepts
asc
sort by Ascending Order
desc
sort by Descending Order
orderByName
string
Accepts
asc
sort by Ascending Order
desc
sort by Descending Order
For checking the object structure(DTO) that was sent or received via API, do check the DTO used in the Application page.
Last updated
Was this helpful?