• Get Access token

    Endpoint (POST)

    https://{authenticationServerLink}/oauth/token
  • Endpoint and data format

    header

    Client:digi 
    Password:password

    body

    												    
    												        "username":"email registered with grydsense" 
    "password":"your password"
    "grant_type":"password"

    Response

    												    
    												        {  access_token: "" expires_in: 43199 jti: "" refresh_token: "" scope: "read write" token_type: "bearer"  }  
    												

    Example:

    public OAuth2RestOperations getAccessToken(String userName, String password, String link) { 
    											
    ResourceOwnerPasswordResourceDetails resource = new ResourceOwnerPasswordResourceDetails(); resource.setAccessTokenUri(link); resource.setClientId("digi"); resource.setClientSecret("password"); resource.setGrantType("password"); resource.setUsername(userName); resource.setPassword(password); AccessTokenRequest atr = new DefaultAccessTokenRequest(); OAuth2RestOperations obj = new OAuth2RestTemplate(resource, new DefaultOAuth2ClientContext(atr)); return obj;
    }
  • Get Entity Types List

    Endpoint (GET)

    https://{link}/v1.0/entity-types-management/?access_token={access_token}

    Response

    [ { 
    												"entity_type_id": 56, 
    												"entity_type": "Air Handling Units" 
    												} ] 

    Example:

    ResponseEntity <EntityTypes[]> response = restTemplate.getForEntity(link, EntityTypes[].class);  log.info(response.toString());   
    											EntityTypes[] entityTypes = response.getBody();  
  • Get Space Log Data

    Endpoint (GET)

    https://{link}/v1.0/occupancy/?access_token={access_token}

    Request Param

     buildingid: buildingentityid (required param) 
    												floorid: floorentityid (optional) 
    												from: date (string utc optional)  
    												to: date (string utc optionl) 

    Response

    [ { 
    												    "timestamp": "2023-02-28 08:02:49", 
    												    "status": "available", 
    												    "building_id": 62, 
    												    "floor_id": 64, 
    												    "sensor_id": "2400_10513", 
    												    "entity_id": 10513 
    												    },  
    												    { 
    												    "timestamp": "2023-02-28 08:01:16", 
    												    "count": 0, 
    												    "building_id": 62, 
    												    "floor_id": 64, 
    												    "sensor_id": "2100_6916", 
    												    "entity_id": 6916 
    												    } ]   

    Example:

    ResponseEntity<SpaceApiDataPojo[]> response1 = restTemplate.getForEntity(link,
        											SpaceApiDataPojo[].class);
        											SpaceApiDataPojo[] data = response1.getBody(); 
  • Get Tree Data

    Endpoint (GET)

    https://{link}/v1.0/tree/?access_token={access_token}

    Response

    [ {  
    													 "entity_id": 1,
    													 "entity_name": "string",
    													 "parent_entity_id": 2,
    													 "entity_type_id": 3  
    													 } ]  

    Example:

    ResponseEntity<ApiEntityTreePojo[]> response2 = restTemplate.getForEntity(link, 
        											ApiEntityTreePojo[].class);
        											ApiEntityTreePojo[] data2 = response2.getBody(); 
  • Register Endpoint

    Registering api to push log data.

    Request Body:

    { 
    													 "dataPostUrl":"",  
    													 "frequency":  in minutes  
    													 }  Frequency is optional where if no frequency is given data will be posted to server immediately.

    Response

    On successful completion: 200 OK.  
    												On unknown error: 500 Internal server error, error body.  
    												On data format mismatches: 400 Bad request.  
    												On incorrect authorization: 401: Unauthorized  

    Note: For oauth2 client id and client secret will be required.

  • Posting Data to server

    Pushing data to immediately or periodically depending on configuration

    Endpoint (POST)

    Link registered with us

    Body

    [ {
    												"timestamp": "2023-02-28 08:02:49",
    												"status": "available",
    												"building_id": 62,
    												"floor_id": 64,
    												"sensor_id": "2400_10513",
    												"entity_id": 10513 
    												},  
    												{
    												"timestamp": "2023-02-28 08:01:16",
    												"count": 0,
    												"building_id": 62,
    												"floor_id": 64,
    												"sensor_id": "2100_6916",
    												"entity_id": 6916
    												} ]
    												For cubicles - Status would be "occupied", "available".
    												For conference room and collaboration: "count" is occupied count 

Get started with Omnos