Location to floor plan mapping

Now that we have added both the floor plans and the locations to the project we can map those two together. A floor plan is usually attached to a location in order for the end-user to be able to quickly select which floor plan the Congrid system shows for each location.


NOTE

A floor plan attached to a parent location will be visible for all it's child locations unless a child location has a different floor plan explicitly attached to it.


Adding floor plan to a location

Lets add a floor plan for a location. Remember the id property of both the floor plan and the location from previous sections.

The location id was N5x0l5zFmfuQB12IYHXf6VbHY5jds19N

The floor plan id was cdGe1mPC8r2lYLYp1KVyQg1GECnP2uvj

Request:

curl
JavaScript
curl -X POST -H "Content-Type: application/json" -H "Congrid-API-Token: YOUR-API-TOKEN" \
 -d '{
   "targetId" : "N5x0l5zFmfuQB12IYHXf6VbHY5jds19N",
   "floorPlanId" : "cdGe1mPC8r2lYLYp1KVyQg1GECnP2uvj"
  }' "https://api.congrid.com/v1/projects/PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ/targetFloorPlans"
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.congrid.com/v1/projects/PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ/targetFloorPlans',
  headers: 
   { 'congrid-api-token': 'YOUR-API-TOKEN',
     'content-type': 'application/json' },
  body: 
   { targetId: 'N5x0l5zFmfuQB12IYHXf6VbHY5jds19N',
     floorPlanId: 'cdGe1mPC8r2lYLYp1KVyQg1GECnP2uvj' },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response:

{
  "floorPlanId": "cdGe1mPC8r2lYLYp1KVyQg1GECnP2uvj",
  "targetId": "N5x0l5zFmfuQB12IYHXf6VbHY5jds19N",
  "id": "21761"
}

Verify the mappings

Lets verify all the location to floor plan mappings

Request:

curl
JavaScript
curl -X GET -H "Congrid-API-Token: YOUR-API-TOKEN" -H "Content-Type: application/json" \
"https://api.congrid.com/v1/projects/PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ/targetFloorPlans"
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.congrid.com/v1/projects/PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ/targetFloorPlans',
  headers: 
   { 'content-type': 'application/json',
     'congrid-api-token': 'YOUR-API-TOKEN' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response:

{
  "count": 1,
  "pageSize": 100,
  "results": [
    {
      "floorPlanId": "cdGe1mPC8r2lYLYp1KVyQg1GECnP2uvj",
      "targetId": "N5x0l5zFmfuQB12IYHXf6VbHY5jds19N",
      "id": "21761"
    }
  ]
}

results matching ""

    No results matching ""