Retrieving the Document Structure Using the GetDocStructure Action
This example shows you how to retrieve the structure of a document with the root document OID specified in the request URI using $expand on the Structure navigation property.
In this example, the user has access to the CHILD1_A document that has another child document CHILD1_A1 under it.
Use the following GET URI:
URI
GET /Windchill/servlet/odata/DocMgmt/Documents('OR:wt.doc.WTDocument:286058')/PTC.DocMgmt.GetDocStructure?$expand=Structure($expand=Document($select=Name);$levels=max),Document($select=Name)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{}
Response
{
"@odata.context": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/$metadata#PTC.DocMgmt.DocStructure",
"DocumentID": "OR:wt.doc.WTDocument:286058",
"DocumentUseID": null,
"HasChildren": true,
"HasUnresolvedObjectsByAccessRights": false,
"TreeId": "/",
"@PTC.AppliedContainerContext.LocalTimeZone": "Asia/Calcutta",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286058')",
"ID": "OR:wt.doc.WTDocument:286058",
"Name": "TOP_DOC"
},
"Structure": [
{
"DocumentID": "OR:wt.doc.WTDocument:286086",
"DocumentUseID": "OR:wt.doc.WTDocumentUsageLink:286094",
"HasChildren": false,
"HasUnresolvedObjectsByAccessRights": null,
"TreeId": "/0000000703-286094",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286086')",
"ID": "OR:wt.doc.WTDocument:286086",
"Name": "CHILD2"
},
"Structure": []
},
{
"DocumentID": "OR:wt.doc.WTDocument:286207",
"DocumentUseID": "OR:wt.doc.WTDocumentUsageLink:286076",
"HasChildren": true,
"HasUnresolvedObjectsByAccessRights": null,
"TreeId": "/0000000702-286076",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286207')",
"ID": "OR:wt.doc.WTDocument:286207",
"Name": "CHILD1"
},
"Structure": [
{
"DocumentID": "OR:wt.doc.WTDocument:286256",
"DocumentUseID": "OR:wt.doc.WTDocumentUsageLink:286248",
"HasChildren": true,
"HasUnresolvedObjectsByAccessRights": null,
"TreeId": "/0000000702-286076/0000000706-286248",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286256')",
"ID": "OR:wt.doc.WTDocument:286256",
"Name": "CHILD1_A"
},
"Structure": [
{
"DocumentID": "OR:wt.doc.WTDocument:286313",
"DocumentUseID": "OR:wt.doc.WTDocumentUsageLink:286321",
"HasChildren": false,
"HasUnresolvedObjectsByAccessRights": null,
"TreeId": "/0000000702-286076/0000000706-286248/0000000707-286321",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286313')",
"ID": "OR:wt.doc.WTDocument:286313",
"Name": "CHILD1_A1"
},
"Structure": []
}
]
}
]
}
]
}
The request returns the structure with the value of HasUnresolvedObjectsByAccessRights as false for the TOP_DOC document specified in the request URI.
In the following example, consider that the user does not have access to the CHILD1_A document, which has another child document CHILD1_A1 under it.
Use the following GET URI:
URI
GET /Windchill/servlet/odata/DocMgmt/Documents('OR:wt.doc.WTDocument:286058')/PTC.DocMgmt.GetDocStructure?$expand=Structure($expand=Document($select=Name);$levels=max),Document($select=Name)
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{}
Response
{
"@odata.context": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/$metadata#PTC.DocMgmt.DocStructure",
"DocumentID": "OR:wt.doc.WTDocument:286058",
"DocumentUseID": null,
"HasChildren": true,
"HasUnresolvedObjectsByAccessRights": true,
"TreeId": "/",
"@PTC.AppliedContainerContext.LocalTimeZone": "Asia/Calcutta",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286058')",
"ID": "OR:wt.doc.WTDocument:286058",
"Name": "TOP_DOC"
},
"Structure": [
{
"DocumentID": "OR:wt.doc.WTDocument:286207",
"DocumentUseID": "OR:wt.doc.WTDocumentUsageLink:286076",
"HasChildren": true,
"HasUnresolvedObjectsByAccessRights": null,
"TreeId": "/0000000702-286076",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286207')",
"ID": "OR:wt.doc.WTDocument:286207",
"Name": "CHILD1"
},
"Structure": [
{
"DocumentID": "OR:wt.doc.WTDocumentMaster:286226",
"DocumentUseID": "OR:wt.doc.WTDocumentUsageLink:286248",
"HasChildren": false,
"HasUnresolvedObjectsByAccessRights": null,
"TreeId": "/0000000702-286076/0000000706-286248",
"Document": null,
"Structure": []
}
]
},
{
"DocumentID": "OR:wt.doc.WTDocument:286086",
"DocumentUseID": "OR:wt.doc.WTDocumentUsageLink:286094",
"HasChildren": false,
"HasUnresolvedObjectsByAccessRights": null,
"TreeId": "/0000000703-286094",
"Document": {
"@odata.id": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v6/DocMgmt/Documents('OR:wt.doc.WTDocument:286086')",
"ID": "OR:wt.doc.WTDocument:286086",
"Name": "CHILD2"
},
"Structure": []
}
]
}
The request returns the structure with the value of HasUnresolvedObjectsByAccessRights as true for the TOP_DOC document specified in the request URI.
Was this helpful?