Web Interface and Publisher > Web Interface > Web Interface REST service > Requesting resources through the REST service > Requesting the available versions of a model (Web Interface REST service)
Requesting the available versions of a model (Web Interface REST service)
The ModelVersions request returns resource properties and URIs for the versions of a model that can be accessed.
In addition to returning model versions (e.g. 0,1,2 etc.), the request also provides a canonical, or a current, model version which is always the latest model version.
Use the canonical model version if you want to always see data from the latest version of a model. The canonical model version allows URIs to be used/stored that will not become stale as models are versioned.
If data from a specific model version is required, the version number should be used.
Request
The syntax of the URI for a ModelVersions request is as follows.
<Web Interface website>/ModelerService/Servers/<server name>/Repositories/<repository name>/Models/<model name>/ModelVersions
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, against which the Model Versions operation is being run.
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.
Returned XML
A ModelVersions request returns a resource URI for each version of the model and for the current version of the model.
The syntax of returned URIs is as follows.
<Web Interface website>/ModelerService/Servers/<server name>/Repositories/<repository name>/Models/<model name>/ModelVersions/<version>
or
<Web Interface website>/ModelerService/Servers/<server name>/Repositories/<repository name>/Models/<model name>/ModelVersions/current
When you use the preceding URIs, the REST service returns operation URIs for operation requests that can be used against the specific versions of the model, or the current version.
Example
In this example, the following ModelVersions request returns a resource URI for each version of the Model1 model.
https://localhost:57850/ModelerService/Servers/Server101/Repository/Example1/Models/Model1/ModelVersions
The returned XML is as follows. You can see that there are URIs for version 0, 1, and 2 of Model1 as well as a URI for the current version of Model1. In this example, it is version 2.
<?xml version="1.0"?>
<ArrayOfModelVersion xmlns:i="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://schemas.datacontract.org/2004/07/StudioRESTService.ModelerRESTService">
<ModelVersion>
<RequestResult>Complete</RequestResult>
<RequestResultType>Resource</RequestResultType>
<ID>SERVER101/Examples/Model1/0</ID>
<Name>0</Name>
<ResourceType>Model Version</ResourceType>
<URIs>
<URI>
<href>https://localhost:57850/ModelerService/Servers/Server101/Repositories/Examples/Models/Model1/ModelVersions/0</href>
</URI>
</URIs>
<IsFavourite>false</IsFavourite>
<WebInterfaceLink>https://localhost:57850/showitem?srvNm=Server101+repNm=Models+modNm=Model1+modVe=0</WebInterfaceLink>
<rel>predecessor-version</rel>
</ModelVersion>
<ModelVersion>
<RequestResult>Complete</RequestResult>
<RequestResultType>Resource</RequestResultType>
<ID>SERVER101/Examples/Model1/1</ID>
<Name>0</Name>
<ResourceType>Model Version</ResourceType>
<URIs>
<URI>
<href>https://localhost:57850/ModelerService/Servers/Server101/Repositories/Examples/Models/Model1/ModelVersions/1</href>
</URI>
</URIs>
<IsFavourite>false</IsFavourite>
<WebInterfaceLink>https://localhost:57850/showitem?srvNm=Server101+repNm=Models+modNm=Model1+modVe=1</WebInterfaceLink>
<rel>predecessor-version</rel>
</ModelVersion>
<ModelVersion>
<RequestResult>Complete</RequestResult>
<RequestResultType>Resource</RequestResultType>
<ID>SERVER101/Examples/Model1/2</ID>
<Name>0</Name>
<ResourceType>Model Version</ResourceType>
<URIs>
<URI>
<href>https://localhost:57850/ModelerService/Servers/Server101/Repositories/Examples/Models/Model1/ModelVersions/2</href>
</URI>
</URIs>
<IsFavourite>false</IsFavourite>
<WebInterfaceLink>https://localhost:57850/showitem?srvNm=Server101+repNm=Models+modNm=Model1+modVe=2</WebInterfaceLink>
<rel>latest-version</rel>
<ModelVersion>
<RequestResult>Complete</RequestResult>
<RequestResultType>Resource</RequestResultType>
<ID>SERVER101/Examples/Model1/current</ID>
<Name>0</Name>
<ResourceType>Model Version</ResourceType>
<URIs>
<URI>
<href>https://localhost:57850/ModelerService/Servers/Server101/Repositories/Examples/Models/Model1/ModelVersions/current</href>
</URI>
</URIs>
<IsFavourite>false</IsFavourite><WebInterfaceLink>
https://localhost:57850/showitem?srvNm=Server101+repNm=Models+modNm=Model1+modVe=current</WebInterfaceLink>
<rel>canonical</rel>
</ModelVersion>
</ArrayOfModelVersion>