Requesting the child items of an item (Web Interface REST service)
The ChildItems request returns resource URIs for the child items of an item.
Request
The syntax of the URI for a ChildItems request is as follows.
<Web Interface website>/ModelerService/Servers/<server name>/Repositories/<repository name>/Models/<model name>/ModelVersions/<version/Item/<item id>ChildItems
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 database.
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 ChildItems operation is being run.
You can find out the ids of items through operation requests such as ChildItems operation request.
Returned XML
A ChildItems request returns a resource URI for each child item of the <item id> item.
The syntax of a 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 operation URIs for operation requests that can be used against the item.
Example
In this example, the following ChildItems request returns a resource URI for each item that is a child item of Package1 (the item id of Package1 is c61e8c1b-6c26-44a7-b2e3-c880906400e8).
https://localhost:57850/ModelerService/Servers/Server101/Repository/Example1/Models/Model1/ModelVersions/0/Item/c61e8c1b-6c26-44a7-b2e3-c880906400e8/ChildItems
The returned XML is as follows. You can see that Package1 has only one child item, that is, Class1. You can also see that there is a URI for Class1 (e475d03c-9ed2-45b8-b943-e08d3892651b).
<?xml version="1.0"?>
<ArrayOfModelItem xmlns:i="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://schemas.datacontract.org/2004/07/StudioRESTService.ModelerRESTService">
<ModelItem>
<RequestResult>Complete</RequestResult>
<RequestResultType>Resource</RequestResultType>
<ID>e475d03c-9ed2-45b8-b943-e08d3892651b</ID>
<Name>Class1</Name>
<ResourceType>Class</ResourceType>
<URIs>
<URI>
<href>https://localhost:57850/ModelerService/Servers/Server101/Repositories/Examples/Models/Model1/ModelVersions/0/Item/e475d03c-9ed2-45b8-b943-e08d3892651b</href>
</URI>
</URIs>
<Ip/>
<StyleIcon>false</StyleIcon>
<Tg>DIC</Tg>
<Ty>Class</Ty>
<WebInterfaceLink>https://localhost:57850/showitem?srvNm=Server101+repNm=Models+modNm=Model1+modVe=0+itemID=e475d03c-9ed2-45b8-b943-e08d3892651b</WebInterfaceLink>
</ModelItem>
</ArrayOfModelItem>