Get List of Models

In Zoho IoT, a model is like a container that can be configured with different templates (datapoints, commands, alarm rules, and fields). The model API allows the user to get the list of all models under a managed entity module such as devices, assets, or locations.
 

Purpose

To get the list of all models under a module such as devices, assets, or locations.

Request  Details


Request URL

{api-domain}/iot/{version}/settings/models

Request Method

GET

To get models for a module:

{api-domain}/iot/{version}/settings/models?module={module_api_name}&view_mode=list&check_permission_view=true

Note: "api-domain" must be replaced with your application domain e.g. "app1234xxxx.zohoiot.in"  

 

Supported modules  

Devices, Assets, Locations.

 

Headers  

Authorization: Zoho-oauthtoken {{oauth}}

 

Scope  

scope=ZohoIOT.modules.{module_name}.{operation_type}
or
scope=ZohoIOT.modules.ALL

 

Possible operation types   
 

ALL - Full access to the record
READ - Get models from the module

 

Parameters  
 

Param - module, mandatory

  • module - string, mandatory (api name of the module)

     To get the list of models for the module. 
     Possible values: devices, assets, locations.

  • check_permission_view,boolean, optional

     To retrieve specific models based on their permission.
     Possible values: true or false

  • view_mode,string, optional

     To view the list of models.
     Possible values: list     

Sample Request: First API Call

Copiedcurl --location -g '{{api-domain}}/iot/v1/settings/models?module=devices&view_mode=list&check_permission_view=true' \
--header 'Authorization: Zoho-oauthtoken {{oauth}}' \
--header 'Content-Type: application/json'

Note: "api-domain" must be replaced with your application domain e.g. "app1234xxxx.zohoiot.in"  
          "oauth" must be replaced with your oauth token.

Response to the First API Call

Copied"models": [
        {
            "image": "nsxe44833de266bd8463c855e1a9c6951a833",
            "settings": {
                "show_instance_dashboard": false,
                "allow_instance_specific_command": false,
                "default_location_preference": "datapoint",
                "allow_instance_specific_datapoint": false,
                "allow_instance_specific_alarmrule": false,
                "auto_load_onboarding_assistant": true
            },
            "module": {
                "api_name": "devices",
                "name": "Devices",
                "icon": "device",
                "id": "2260000000046124"
            },
            "profiles": [
                {
                    "name": "Administrator",
                    "id": "2260000000196005"
                },
                {
                    "name": "Developer",
                    "id": "2260000000196008"
                }
            ],
            "icon": "device",
            "description": "Model for experiencing Zoho IOT application by using your smartphone as IoT Device",
            "$is_imported": true,
            "display_name": "Smart IoT Emulator",
            "type": {
                "api_name": "device",
                "name": "Device",
                "icon": "device",
                "description": "Device",
                "id": "2260000000186001",
                "enabled": true
            },
            "discriminator": "Devices", 
            "resource_category": {
                "is_deletable": true,
                "is_editable": false
            },
            "enable_geo_tracking": false,
            "quick_create": true,
            "name": "Smart IoT Emulators",
           
            "id": "2260000000230484",
            "status": "Active"
        }
    ],
    "info": {
        "page": 1,
        "count": 4,
        "per_page": 4,
        "more_records": false
    }
}