Integrating : Integrating with applications that support REST XML APIs : Example: Retrieving artifacts from applications supporting RESTful API
  
Example: Retrieving artifacts from applications supporting RESTful API
This example describes how to retrieve artifacts from the Requirements Management application of Rational solution for Collaborative Lifecycle Management and create elements in Focal Point®.
Purpose
If you have requirements in the Requirements Management application and want to prioritize them in Focal Point®, you can use the REST client view command to retrieve the requirements.
Prerequisite
Set the IP address and hostname of the Rational solution for CLM server in the host file of the computer from where you are configuring the integration. For Windows, the host file is typically located at C:\Windows\System32\drivers\etc and for Linux the hose file is located at /etc/hosts.
Add the Requirements Management application as a Friends(Outbound) in Focal Point®. For more information, see Connecting to the Rational solution for Collaborative Lifecycle Management application server.
Be aware of the XML structure of the Requirements Management application artifacts and have the rights to access them.
Example
This example assumes that Focal Point® has a workspace “FP-RRC” and a view “View RRC Requirements”. These are some of the attributes available in Focal Point® and the Requirements Management application:
 
Focal Point® attributes
Requirements Management application attributes
Fuel choice
rrm:description
Fuel efficiency
rrm:collaboration/rrm:attributes/attribute:objectType/attribute:customAttribute/@attribute:isEnumeration
Integration Link
rrm:collaboration/rrm:attributes/attribute:objectType/@attribute:projectAreaName
Title
ds:location/ds:project/rrm:title
1 In Focal Point®, open the FP-RRC workspace where you want to retrieve the artifacts.
2 Click the Settings icon Settings icon, and then, from the Configure group, click REST client view command.
3 In REST Client Connector Name, type a RRC connector for identifying the connection.
4 In REST Request Method, select the GET method.
5 In Friends List, select RRC.
6 In REST Application Request URL, type the application URL that contains the artifacts that you want to retrieve. For example, to get the artifacts from the Requirements Management application, type:
https://<hostName>:<portNumber>/rm/<projectName>/<collectionName>
Tip Open a web browser and type the URL that you used when adding the Requirements Management application as a friend. A list of high-level artifacts is displayed. Find out the artifact that you want to retrieve and copy its URL in REST Application Request URL.
7 Click Connect.
8 Click Select Root XPath to restrict your search for artifacts to a collection, and then select:
/ds:dataSource/ds:artifact
XPath is used to narrow down the search to the artifacts. XPaths are hierarchical XML structure of an application.
9 To ensure that the artifacts are not duplicated, in the ID Mapping section, click Add and map Fuel choice of Focal Point® and rrm:description of the Requirements Management application. You can map only one attribute.
10 In the Attributes Mapping section, click Add to map the following attributes between the Requirements Management application and Focal Point®. The mapped attributes are displayed against the element retrieved from the application. Ensure that the attributes are editable.
The attribute that you selected in the ID Mapping section is not displayed in the Attributes Mapping section because that attribute is internally mapped and is available for the fetched elements.
 
Focal Point® attributes
Requirements Management application attributes
Fuel efficiency
rrm:collaboration/rrm:attributes/attribute:objectType/attribute:customAttribute/@attribute:isEnumeration
Integration Link
rrm:collaboration/rrm:attributes/attribute:objectType/@attribute:projectAreaName
Title
ds:location/ds:project/rrm:title
11 In the REST Application supported Date Format field, type:
2012-08-18
12 In the Focal Point® Separator field, retain , as it is.
13 Click Save.
14 Open the “View RRC Requirements” view, and then select RRC Connector from the list.
A list of requirements and attributes are retrieved and created as elements in the view.
See also
Integrating with applications that support REST XML APIs