Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Response

Code Block
[
    {
        "labelId": 101,
        "projectId": {PROJECT_ID},
        "name": "Department",
        "labelValues": null,
        "dateUpdated": 15404802270461540584864274,
        "dateCreated": 15404802270461540584864274
    },
    {
        "labelId": 112,
        "projectId": {PROJECT_ID},
        "name": "Building",
        "labelValues": null,
        "dateUpdated": 15404802270861540584864279,
        "dateCreated": 15404802270861540584864279
    }
]

Retrieve Labels

Request

...

Response

Code Block
[
    {
        "labelId": 101,
        "projectId": {PROJECT_ID},
        "name": "Department",
        "labelValues": null,
        "dateUpdated": 15404927590001540584864274,
        "dateCreated": 15404927590001540584864274
    },
    {
        "labelId": 112,
        "projectId": {PROJECT_ID},
        "name": "Building",
        "labelValues": null,
        "dateUpdated": 15404927590001540584864279,
        "dateCreated": 15404927590001540584864279
    }
]


Create Label Values

Now that you have create your two "Department" and "Building" Labels you need to specify which values these Labels can assigned. Suppose you have two departments "Software Development" and "Sales, and two buildings "IC - 1" and "IC - 2". Below is an example of how to create Label Values for the two Labels. As you can see, the payload of the request is a list of the four values we want to create. Each item in the list is an object that specifies which Label the Label Value belongs to (using the labelId property) and the value.

...

Code Block
curl -X POST \
  https://bluzone.io/portal/papis/v1/projects/{PROJECT_ID}/labelValues \
  -H 'Accept: application/json' \
  -H 'BZID: {API_KEY}' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '[
	{
		"label": {
			"labelId": 10
		}1,
		"value": "Software Development"
	},
	{
		"label": {
			"labelId": 10
		}1,
		"value": "Sales"
	},
	{
		"labellabelId": {2,
			"labelIdvalue": "IC 11
		},
		"value": "IC - - 1"
	},
	{
		"label": {
			"labelId": 11
		}2,
		"value": "IC - 2"
	}
]'

Response

Code Block
[
    {
        "labelValueId": 201,
        "labellabelId": {1,
            "labelIdlabelName": 10"Department",

           "projectId": {PROJECT_ID},
   
        "namevalue": "DepartmentSoftware Development",
  
         "dateUpdated": 1540480227000,1540585112944,
        "dateCreated": 1540585112944
    },
    {
        "dateCreatedlabelValueId": 2,
        "labelId": 15404802270001,
        }"labelName": "Department",
        "projectId": {PROJECT_ID},
        "value": "Software DevelopmentSales",
        "dateUpdated": 15404809379341540585112946,
        "dateCreated": 15404809379341540585112946
    },
    {
        "labelValueId": 213,
        "labellabelId": {2,
            "labelIdlabelName": 10,
   "Building",
        "projectId": {PROJECT_ID},
            "namevalue": "DepartmentIC - 1",
  
         "dateUpdated": 15404802270001540585112947,
            "dateCreated": 15404802270001540585112947
    },
    },{
        "projectIdlabelValueId": {PROJECT_ID}4,
        "valuelabelId": "Sales"2,
        "dateUpdatedlabelName": 1540480937947"Building",
        "dateCreatedprojectId": 1540480937947
    {PROJECT_ID},
    {    "value": "IC -   "labelValueId": 222",
        "labeldateUpdated": {1540585112949,
            "labelIddateCreated": 11,1540585112949
    }
]

Retrieve Label Values

Request

Code Block
curl -X GET \
   "projectId": https://bluzone.io/portal/papis/v1/projects/{PROJECT_ID},/labelValues \
  -H 'Accept: application/json' \
     "name": "Building",
-H 'BZID: {API_KEY}' \
  -H 'Content-Type: application/json' \
  -H   "dateUpdated'cache-control: no-cache'

Response

Code Block
[
    {
        "labelValueId": 15404802270001,
   
        "dateCreatedlabelId": 15404802270001,
        }"labelName": "Department",
        "projectId": {PROJECT_ID},
        "value": "ICSoftware - 1Development",
        "dateUpdated": 15404809379511540585112944,
        "dateCreated": 15404809379511540585112944
    },
    {
        "labelValueId": 232,
        "labellabelId": {1,
            "labelId": 11"labelName": "Department",
            "projectId": {PROJECT_ID},
   
        "namevalue": "BuildingSales",
            "dateUpdated": 15404802270001540585112946,
            "dateCreated": 15404802270001540585112946
    },
   }, {
        "projectIdlabelValueId": {PROJECT_ID}3,
        "valuelabelId": "IC - 2",
        "dateUpdatedlabelName": 1540480937963"Building",
        "dateCreatedprojectId": 1540480937963
{PROJECT_ID},
   } ]

Retrieve Label Values

Request

Code Block
curl -X GET \ "value":  https://bluzone.io/portal/papis/v1/projects/{PROJECT_ID}/labelValues \"IC - 1",
  -H 'Accept: application/json' \   -H 'BZID: {API_KEY}' \"dateUpdated": 1540585112947,
       -H 'Content-Type: application/json' \ "dateCreated": 1540585112947
   -H 'cache-control: no-cache'

Response

Code Block
[ },
     {
        "labelValueId": 204,
        "labellabelId": {
   2,
        "labelIdlabelName": 10"Building",
            "projectId": {PROJECT_ID},
 
          "namevalue": "DepartmentIC - 2",
            "dateUpdated": 15404802270001540585112949,

           "dateCreated": 1540480227000
  1540585112949
     },
        "projectId": {PROJECT_ID},
        "value": "Software Development",
        "dateUpdated": 1540480937934,
        "dateCreated": 1540480937934
    },
    {
        "labelValueId": 21,
        "label": {
            "labelId": 10,
            "projectId": {PROJECT_ID},
            "name": "Department",
            "dateUpdated": 1540480227000,
            "dateCreated": 1540480227000
        },
        "projectId": {PROJECT_ID},
        "value": "Sales",
        "dateUpdated": 1540480937947,
        "dateCreated": 1540480937947
    },
    {
        "labelValueId": 22,
        "label": {
            "labelId": 11,
            "projectId": {PROJECT_ID},
            "name": "Building",
            "dateUpdated": 1540480227000,
            "dateCreated": 1540480227000
        },
        "projectId": {PROJECT_ID},
        "value": "IC - 1",
        "dateUpdated": 1540480937951,
        "dateCreated": 1540480937951
    },
    {
        "labelValueId": 23,
        "label": {
            "labelId": 11,
            "projectId": {PROJECT_ID},
            "name": "Building",
            "dateUpdated": 1540480227000,
            "dateCreated": 1540480227000
        },
        "projectId": {PROJECT_ID},
        "value": "IC - 2",
        "dateUpdated": 1540480937963,
        "dateCreated": 1540480937963
    }
]

Associate Beacon-Label Values

Finally, lets associate these labels to a Beacon. Suppose you have a Beacon that belongs to the "Software Development" Department and is in Building "IC-1". There are two methods for applying Labels to Beacons:

Method 1

For this method, the payload of the request is simply a list of labelValueId (20 and 22) . If successful, the response will be the LabelValue objects associated to the IDs.

Request

Code Block
curl -X PUT \
  https://bluzone.io/portal/papis/v1/projects/{PROJECT_ID}/devices/beacons/{BEACON_ID}/_labelValues \
  -H 'BZID: {API_KEY} \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '[
    20, 22
]'

Response

Code Block
[
    {
        "labelValueId": 22,
        "label": {
            "labelId": 11,
            "projectId": {PROJECT_ID},
            "name": "Building",
            "dateUpdated": 1540480227000,
            "dateCreated": 1540480227000
        },
        "projectId": {PROJECT_ID},
        "value": "IC - 1",
        "dateUpdated": 1540480938000,
        "dateCreated": 1540480938000
    },
    {
        "labelValueId": 20,
        "label": {
            "labelId": 10,
            "projectId": {PROJECT_ID},
            "name": "Department",
            "dateUpdated": 1540480227000,
            "dateCreated": 1540480227000
        },
        "projectId": {PROJECT_ID},
        "value": "Software Development",
        "dateUpdated": 1540480938000,
        "dateCreated": 1540480938000
    }
]

Method 2

Alternatively, you can update the Beacon directly using our existing API.

Request

Code Block
curl -X PUT \
  https://bluzone.io/portal/papis/v1/projects/{PROJECT_ID}/devices/beacons/{BEACON_ID} \
  -H 'Accept: application/json' \
  -H 'BZID: {API_KEY}' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
    "deviceId": {BEACON_ID},
    "projectId": {PROJECT_ID},
    ... // other properties are omitted for sake of brevity 
    "labelValues": [
        {
   
]


Associate Beacon-Label Values

Finally, lets associate these labels to a Beacon. Suppose you have a Beacon that belongs to the "Software Development" Department and is in Building "IC-1". There are two methods for applying Labels to Beacons:

Method 1

For this method, the payload of the request is simply a list of labelValueId (20 and 22) . If successful, the response will be the LabelValue objects associated to the IDs.

Request

Code Block
curl -X PUT \
  https://bluzone.io/portal/papis/v1/projects/{PROJECT_ID}/devices/beacons/{BEACON_ID}/_labelValues \
  -H 'BZID: {API_KEY} \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '[
    1, 3
]'

Response

Code Block
[
    {
        "labelValueId": 3,
        "labelId": 2,
        "labelName": "Building",
        "projectId": 10,
        "value": "IC - 1",
        "dateUpdated": 1540585113000,
        "dateCreated": 1540585113000
    },
    {
        "labelValueId": 201,

           "labellabelId": {1,
        "labelName": "Department",
        "labelIdprojectId": 10,
        "value": "Software Development",
   },     "dateUpdated": 1540585113000,
        "valuedateCreated": "Software Development"1540585113000
    }
]


Method 2

Alternatively, you can update the Beacon directly using our existing API.

Request

Code Block
curl -X PUT },\
		{
    https://bluzone.io/portal/papis/v1/projects/{PROJECT_ID}/devices/beacons/{BEACON_ID} \
  -H 'Accept: application/json' \
   "labelValueId": 22,
-H 'BZID: {API_KEY}' \
  -H 'Content-Type: application/json' \
     "label": {
-H 'cache-control: no-cache' \
  -d '{
    "deviceId": {BEACON_ID},
     "labelIdprojectId": 11{PROJECT_ID},
    ... // other properties are omitted for sake of },brevity 
    "labelValues": [
     "value": "IC - 1"{
        }     ]
}'

Response

Code Block
{"labelValueId": 1,
     "deviceId": {BEACON_ID},       "projectIdlabelId": {PROJECT_ID},1,
      ...      "labelValuesvalue": ["Software Development"
       { },
         {
 "labelValueId": 20,             "labellabelValueId": {3,
                "labelId": 102,
            "value": "IC - 1"
 "projectId": {PROJECT_ID},      }
    ]
}'

Response

Code Block
{
    "namedeviceId": "Department"{BEACON_ID},
    "projectId": {PROJECT_ID},
    ... 
    "dateUpdatedlabelValues": 1540480227000,[
        {
       "dateCreated": 1540480227000             }"labelValueId": 3,
            "projectIdlabelId": {PROJECT_ID}2,
            "valuelabelName": "Software DevelopmentBuilding",
            "dateUpdatedprojectId": 154048093800010,
            "dateCreatedvalue": 1540480938000"IC - 1",
      }, 		{
        	"labelValueIddateUpdated": 221540585113000,
	        "label": {   "dateCreated": 1540585113000
	        "labelId": 11,
    },
   	    "projectId": {PROJECT_ID}, {
            	"namelabelValueId": "Building"1,
	            "dateUpdatedlabelId": 15404802270001,
    	        "dateCreatedlabelName": 1540480227000
	 "Department",
       },     	    "projectId": {PROJECT_ID}10,
        	    "value": "ICSoftware - 1Development",
  	          "dateUpdated": 15404809380001540585113000,
        	    "dateCreated": 1540585113000
   1540480938000     	}
    ]
}


List of REST APIs

To get started quickly with the Labels we recommend importing our Postman collection. To import the collections simply navigate to Postman > "Import" from the top menu > "Import From Link" > Paste in link: https://www.getpostman.com/collections/2ee42c456b3dc13a5587. Note, you will need to update the variables to reflect your own project parameters.