Overview
This API endpoint allows you to fetch all locations in a single call, returning an array of objects with the full hierarchy: site, building, floor, room, and bed.
Endpoint Details
Method
GET
URL
https://api.mosler.in/api/v3/location/all
Authentication
|
apikey | string | Yes | Your API key for authentication |
Content-Type | string | No | application/json |
Query Parameters
|
page | number | No | Page number for pagination (default: 1) |
limit | number | No | Number of locations per page (default: 100, max: 100) |
Response Format
Success Response
|
message | string | Success message describing the operation |
code | number | Status code indicating successful operation |
error | boolean | Always false for successful responses |
data | object | Object containing locations data and pagination info |
Data Object Structure
|
locations | array | Array of location objects |
pagination | object | Pagination information |
total | number | Total number of locations available |
Location Object Structure
|
site | object | Site object { name, _id } |
building | object | Building object { name, _id } |
floor | object | Floor object { name, _id } |
room | object | Room object { name, _id } |
bed | object | Bed object { name, _id } |
|
currentPage | number | Current page number |
totalPages | number | Total number of pages available |
hasNext | boolean | Whether there are more pages |
hasPrevious | boolean | Whether there are previous pages |
Response Examples
Successful Response
{
"message": "Locations retrieved successfully",
"code": 7010,
"error": false,
"data": {
"locations": [
{
"site": { "name": "Delhi", "_id": "6530f9dce0c1bd73ded0d1be" },
"building": {
"name": "Main Tower",
"_id": "6530f9dce0c1bd73ded0d1be"
},
"floor": {
"name": "First Floor",
"_id": "6530f9dce0c1bd73ded0d1be"
},
"room": { "name": "101", "_id": "6530f9dce0c1bd73ded0d1be" },
"bed": { "name": "Bed 1", "_id": "6530f9dce0c1bd73ded0d1be" }
}
],
"pagination": {
"currentPage": 1,
"totalPages": 1,
"hasNext": false,
"hasPrevious": false
},
"total": 1
}
}