v3/Location API's

Get Buildings

Overview

This API endpoint allows you to fetch all buildings under a specific site in your company.

Endpoint Details

Method

GET

URL

https://api.mosler.in/api/v3/location/buildings

Authentication

Headers

NameTypeRequiredDescription
apikeystringYesYour API key for authentication
Content-TypestringNoapplication/json

Query Parameters

NameTypeRequiredDescription
site_idstringYesThe unique identifier of the site
pagenumberNoPage number for pagination (default: 1)
limitnumberNoNumber of buildings per page (default: 100, max: 100)

Response Format

Success Response

NameTypeDescription
messagestringSuccess message describing the operation
codenumberStatus code indicating successful operation
errorbooleanAlways false for successful responses
dataobjectObject containing buildings data and pagination info

Data Object Structure

NameTypeDescription
buildingsarrayArray of building objects
paginationobjectPagination information
totalnumberTotal number of buildings available

Building Object Structure

NameTypeDescription
namestringThe name of the building
_idstringThe unique id of building

Pagination Object Structure

NameTypeDescription
currentPagenumberCurrent page number
totalPagesnumberTotal number of pages available
hasNextbooleanWhether there are more pages
hasPreviousbooleanWhether there are previous pages

Response Examples

Successful Response

{
    "message": "Buildings retrieved successfully",
    "code": 7006,
    "error": false,
    "data": {
        "buildings": [
            { "name": "Main Tower", "_id": "6660745995a565fe29d81897" },
            { "name": "Annex", "_id": "53dcs9dce0c1bd73ded0d1be" }
        ],
        "pagination": {
            "currentPage": 1,
            "totalPages": 1,
            "hasNext": false,
            "hasPrevious": false
        },
        "total": 2
    }
}