Web Interface and Publisher > Web Interface > Web Interface REST service > Requesting resources through the REST service > Requesting the parent item of an item (Web Interface REST service)
Requesting the parent item of an item (Web Interface REST service)
The ParentItem request returns the resource URI for the parent item of an item.
Request
The syntax of the URI for a ParentItem request is as follows.
<Web Interface website>/ModelerService/Servers/<server name>/Repositories/<repository name>/Models/<model name>/ModelVersions/<version/Item/<item id>/ParentItem
Where:
<Web Interface website> - is the URI for the Web Interface website.
<server name> - is the name of the server.
If the server name contains reserved characters, those characters must be percent encoded in the URI. Use the Servers operation request to return the URI safe version of the server name.
<repository name> - is the name of the repository.
If the database name contains reserved characters, those characters must be percent encoded in the URI. Use the Repositories operation request to return the URI safe version of the database name.
<model name> - is the name of the model.
If the model name contains reserved characters, those characters must be percent encoded in the URI. Use the Models operation request to return the URI safe version of the model name.
Note that the REST service cannot work with Models that have the percentage character (%) in their names.
<version> - is the version number of the model, as it appears in Model Explorer.
<item id>- is the id of the Modeler item, against which the ParentItem operation is being run.
You can find out the ids of items through operation requests such as ChildItems operation request.
Returned XML
A ParentItem request returns a resource URI for the parent item of the <item id> item.
The syntax of the returned URI is as follows.
<Web Interface website>/ModelerService/Servers/<server name>/Repositories/<repository name>/Models/<model name>/ModelVersions/<version>/Item/<item id>
When you use the preceding URI for an item, the REST service returns URIs for operation requests that can be used against the item.
Example
In this example, the following ParentItem request returns the URI for the parent item of Class1 (the item id of Class1 is e475d03c-9ed2-45b8-b943-e08d3892651b).
https://localhost:57850/ModelerService/Servers/Server101/Repository/Example1/Models/Model1/ModelVersions/0/Item/e475d03c-9ed2-45b8-b943-e08d3892651b/ParentItem
The returned XML is as follows. You can see that the parent item of Class1 is Package1. You can also see that there is a URI for Package1 (c61e8c1b-6c26-44a7-b2e3-c880906400e8).
<?xml version="1.0"?
<ModelItem xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/StudioRESTService.ModelerRESTService">
<RequestResult>Complete</RequestResult
<RequestResultType>Resource</RequestResultType
<ID c61e8c1b-6c26-44a7-b2e3-c880906400e8</ID>
<Name Package1</Name>
<ResourceType Package</ResourceType>
<URIs>
<URI>
<href>https://localhost:57850/ModelerService/Servers/Server101/Repositories/Examples/Models/Model1/ModelVersions/0/Item/c61e8c1b-6c26-44a7-b2e3-c880906400e8</href
</URI>

</URIs>
<Ip/>
<StyleIcon false</StyleIcon>
<Tg DIC</Tg
<Ty Package</Ty>
<WebInterfaceLink>https://localhost:57850/showitem?srvNm=Server101+repNm=Models+modNm=Model1+modVe=0+itemID=c61e8c1b-6c26-44a7-b2e3-c880906400e8</WebInterfaceLink>
</ModelItem
Was this helpful?