Document toolboxDocument toolbox

(sv) Explore Documents and Spots with API (use case)

Translation needed

The content of this page was copied from another page tree and needs to be translated or updated.

When you finish translation, make sure to

  • Replace the label NEEDS-TRANSLATING with TRANSLATED

  • Remove this macro from the page



 Note: this article related to low level API that requires some basic knowledge of REST API requests and JSON. 




Goal

Having an object ID find related data like documents connected directly to this object or documents that contain a spot that this object is linked to.

API calls

Find documents connected directly to this object. If we consider a Building object that has a number of documents connected, if we want to get a list of all documents it can be done using a Perspective call.

The reason for this is that Documents are treated in the same manner as objects (they actually are objects with additional content linked).

Therefore there is no dedicated "documents function". We need a perspective that will tell the system what classes of linked object it should look for. 

Perspectives can also use grouping by parent class, that is often the case for Document classes. 



Getting the data

Get child objects (objects that have an incoming link from our object)

Selected Perspective Set for documents: 10

Object class: 105

Object ID: 76924

ID can be translated to specific domain by using additional API calls.



http://localhost:8080/api/perspective/json/10/105/76924

The result includes all matched objects (filtered by perspective, system versioning, security)

{ "children": [{ "hasChildren": false, "isDefault": false, "metadata": {}, "contentType": 2, "contentId": 45582, "subType": 0, "securityMask": "7", "objectName": "Building facade", "objectId": "210831", "classId": "120" }, { "hasChildren": false, "isDefault": false, "metadata": {}, "contentType": 2, "contentId": 45581, "subType": 0, "securityMask": "7", "objectName": "Building facade", "objectId": "210830", "classId": "111" }], "hasChildren": true, "isDefault": false, "metadata": {}, "contentType": 0, "contentId": 0, "subType": 0, "securityMask": "7", "objectName": "1", "objectId": "76924", "classId": "105" }

Check what is the default document for this object (if any)

http://localhost:8080/api/object/default/105/76924/10

Result - a default object if present in given perspective set. Please note, that each perspective set can have diferent default object!



Check for documents that have spots of this object



Repsonse will be as follows, if the content is found:



For today function to find specific document (that has this conetnt attached) is not present. 

Utilizing obtained information

Obtained information can be used to create individual HOPA calls or to build a simplified viewer showing available documents.