April 11, 2018

New objectid query parameter for Model Derivative Properties API

    This is a long awaited feature by some developers using the Model Derivative API: the GET :urn/metadata/:guid/properties endpoint is now allowing to use a query parameter objectid in order to retrieve properties for a specific component. Not using that optional parameter will return properties for all components in the model.  

    The issue we had in the past is that the returned payload can get quite large when dealing with big BIM models for example containing lots of components with lots of properties each, hence resulting in a failed request or difficulties to parse the payload. These now belong to the past as one can now first retrieve the hierarchy of the model and request the properties on a per-component basis.

    You will need to invoke the following endpoints to leverage that feature:

1/ Using the URN of your translated design, retrieve the list of metadata guids contained in it. For a model containing several viewables, you will get one guid per viewable. If your model has only one view you still need to retrieve what is the guid for that view:

GET :urn/metadata

Here is a sample response used on one of my model:

{
  "statusCode": 200,
  "headers": {
    "access-control-allow-credentials": "true",
      "access-control-allow-origin": "*",
      "content-type": "application/json;
    charset=utf-8",
    "date": "Mon, 02 Apr 2018
    08:15:31 GMT",
    "x-ads-app-identifier": "platform-viewing-2018.01.02.49.b4217d5-production",
      "x-ads-duration": "255
    ms",
    "x-ads-startup-time": "Fri Mar 16
    06:18:48 UTC 2018",
    "content-length": "122",
      "connection": "Close"
  },
  "body": {
    "data": {
      "type": "metadata",
        "metadata": [
        {
          "name": "Analyze.iam",
          "role": "3d",
          "guid": "ab2fb5b0-9101-0d3e-28c9-e61f9f0c15c5"
        }
      ]
    }
  }
}

 

2/ Using a given guid, retrieve the hierarchy of the model in order to identify the objectid you are looking for, or the existing objectids in that model:

GET :urn/metadata/:guid

Sample response for the above guid "ab2fb5b0-9101-0d3e-28c9-e61f9f0c15c5":

{
  "statusCode": 200,
  "headers": {
  "access-control-allow-credentials": "true",
    "access-control-allow-origin": "*",
    "content-type": "application/json;
  charset=utf-8",
  "date": "Mon, 02 Apr 2018
  08:22:59 GMT",
  "x-ads-app-identifier": "platform-viewing-2018.01.02.49.b4217d5-production",
    "x-ads-duration": "77
  ms",
  "x-ads-startup-time": "Fri Mar 16
  06:39:21 UTC 2018",
  "content-length": "693",
    "connection": "Close"
},
  "body": {
    "data": {
      "type": "objects",
        "objects": [
        {
          "objectid": 13,
          "name": "Analyze.iam",
          "objects": [
            {
              "objectid": 15,
              "name": "Upper_Plate:1"
            },
            {
              "objectid": 16,
              "name": "Upper_Plate:2"
            },
            {
              "objectid": 17,
              "name": "Lower_Plate:1"
            },
            {
              "objectid": 12,
              "name": "Lower_Plate:2"
            },
            {
              "objectid": 14,
              "name": "Pin_A:1"
            },
            {
              "objectid": 18,
              "name": "Pin_A:2"
            },
            {
              "objectid": 19,
              "name": "Pin_A:3"
            },
            {
              "objectid": 20,
              "name": "Pin_A:4"
            },
            {
              "objectid": 21,
              "name": "Pin_B:1"
            },
            {
              "objectid": 22,
              "name": "Pivot_Threaded:1"
            },
            {
              "objectid": 23,
              "name": "Handle:1"
            },
            {
              "objectid": 24,
              "name": "Screw:1"
            },
            {
              "objectid": 25,
              "name": "Pivot_Lower:1"
            },
            {
              "objectid": 26,
              "name": "SHCS_10-32x6:1"
            },
            {
              "objectid": 27,
              "name": "ch_09-Upper_Grip.ipt:1"
            },
            {
              "objectid": 28,
              "name": "ch_09-Lower_Grip.ipt:1"
            }
          ]
        }
      ]
    }
  }
}

 

3/ Retrieve properties for a given objectid:

GET :urn/metadata/:guid/properties?objectid={objId}

Here I used objectid=15 in my query string:

{
  "data": {
  "type": "properties",
    "collection": [
      {
        "objectid": 15,
        "name": "Upper_Plate:1",
        "externalId": "8fz31Z_6FEqOu56M881BVw",
        "properties": {
          "Author": "Administrator",
          "label": "Upper_Plate:1",
          "Design Tracking Properties": {
            "Date Created": "1999-05-20", 
            "Design Status": "0",
            "Designer": "Administrator",
            "Part Number": "Upper_Plate"
          },
          "Physical": {
            "Center of Gravity:": "-0.652 in, -0.197 in, -0.437 in",
            "Density": "7.860 kilogram/inch^3",
            "Material": "Steel, Mild"
          }
        }
      }
    ]
  }
}

 

Related Posts

May 10, 2019

Consume AEC Data which are from Model Derivative API

Model Derivative API has been able to extract AEC data of Revit model such as level, grid, views, phase, linked documents etc. And Forge Viewer also provides the corresponding methods ...

Read More

May 8, 2019

Translate composite models (files with references)

This article is to summarise the ways you can translate a composite / multi-file model.

Read More

April 30, 2019

.NET Core joining Learn Forge tutorials

.NET Core tutorial to create View Models sample app. Runs on Windows, Linux and MacOS

Read More