Add Datapoint Template

Purpose

To add a datapoint template for the model.

Endpoints

CopiedPOST/datapointdefinitions 

Request Details       


Request URL  

{api-domain}/iot/{version}/datapointdefinitions 

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

 

Headers          

Authorization: Zoho-oauthtoken {{oauth}}

 

Scope

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



Possible operation types   
  

ALL - Full access to the record
POST - Create datapoints for a model

Sample Request: First API Call

Copiedcurl --location -g --request POST 'https://app88845pcsgg.zohoiotdevportal.com/iot/v1/datapointdefinitions' \
--header 'Authorization: Zoho-oauthtoken 1000.c45897c7b5add57812795dc54a1f57d3.e4e756acda4f3ee70f25b98489dbda84' \
--header 'Content-Type: application/json' \
--data '{
{
    "datapointdefinitions": {
        "active": {
            "id": true
        },
        "kind": {
            "id": "1655000000087581",
            "name": "Default Numeric",
            "icon": "dp-default-numeric",
            "units": [
                {
                    "id": "1655000000087584",
                    "name": "qty"
                },
                {
                    "id": "1655000000087587",
                    "name": "units"
                }
            ]
        },
        "unit": {
            "id": "1655000000087584",
            "name": "qty"
        },
        "datapoint_type": {
            "id": "realtime"
        },
        "ignore_negative_value": false,
        "enable_computation": false,
        "decimal_places": 2,
        "parent_model": {
            "info": {
                "id": "1655000000163003",
                "image": "ift8qc2a3dc6434894c74975e293ff3e61af3",
                "label": "Energy Meter",
                "module": {
                    "api_name": "devices"
                }
            },
            "type": "model"
        },
        "data_type": "Numeric",
        "datapoint_name": "Fuel Level",
        "parsing_key_object": {
            "value": "fuel_level",
            "label": "fuel_level",
            "parsing_type": "direct"
        },
        "parent_type": "model"
    }
}

Response to the First API Call

Copied{
  "datapointdefinitions": [
    {
      "datapoint_name": "Fuel Level",
      "code": "SUCCESS",
      "id": "1655000000177139",
      "message": "record added",
      "status": "success"
    }
  ]
}