Getting Started with OSLC integration
You can integrate IBM® Maximo® Real Estate and Facilities with other applications by using Open Services for Lifecycle Collaboration (OSLC) REST API.
OSLC integration with Maximo Real Estate and Facilities is accomplished between a consumer application and Maximo Real Estate and Facilities, the provider application. As the OSLC provider application, Maximo Real Estate and Facilities makes its resource data available to the consumer application through containers, which are known as service providers. With the resource data made available, the consumer application can create links between its data and the resource data of Maximo Real Estate and Facilities. You can configure and enable any part of Maximo Real Estate and Facilities to act as an OSLC provider application.
Before you begin, you must have:
- Access to the Maximo Real Estate and Facilities server.
- A user with access to builder tools.
- The Advanced REST Client that can be downloaded to Google Chrome or another REST client.
- The Business Object, Form, Query, and Navigation Item.
Creating prerequisites on the Maximo Real Estate and Facilities server
To create and use the OSLC (Open Services for Lifecycle Collaboration) components that integrate with Maximo Real Estate and Facilities, you must complete the following:
- Login to Maximo Real Estate and Facilities and navigate to the Data Modeler.
- Click Home > Tools > Data Modeler.
- Click New and then select New Module.
- Specify the name of the module and then click Save Module.
- In the newly created module, click New and then click New Business Object.
- Specify the name of the Business Object and then click SaveBO.
- Add fields to the BO by either adding them manually or finding them from an existing BO. The fields added to the BO are triControlNumber (Control Number), triNameTX (Text), triDescriptionTX (Text), triRecordIdSY(System Read Only), triRecordNameSY (System Read Only), and triNumber (Number).
- Add a State Transition family:
- Click Tools > BO State Transition. Either set up or import the State Transition.
- To import the State Transition, click Import> Import From Business Object> triPeople for both Module and BO.
- Click Ok, and then click Save.
- Create BO Mapping:
- Click Tools > BO Mapping. In the
following example the BO mapping, set it to show the
ControlNumber, then a hyphen followed byNameor to your own requirements. - Click Save Mapping and then click Publish BO.
- Click Tools > BO Mapping. In the
following example the BO mapping, set it to show the
- Navigate to .
- Select the appropriate Module (amOSLCTutorial) and then click New.
- Select the appropriate BO in the Properties Window. In this example, only one BO amRecord is assigned to this module.
- Click Apply.
- Click Add Tab.
- Specify the name of the tab and then click Apply.
- On the newly created tab click Add Section, provide a name to the section, and then click Apply.
- Add the fields required for the form:
- On the section created in the previous step, click Add Field.
- In the Properties window, select a Data Field from the BO, and then click Apply. In this example, the following fields are added to the form: fields triControlNumber, triNameTX, triDescriptionTX, and triNumber. The form should look something like this:
- Click Publish to publish the form.
- Navigate to .
- Click System Reports tab.
- Click New.
- Specify the name of the query.
- On the Business Object tab, click Add Business Object. On the form, select the Module, Business Object, and Form that were created in the previous steps and click OK.
- Click the Columns tab. Add the fields from the form (ControlNumber, Description, Name, Number) to display in the query.
- Click Save & Close.
- Navigate to .
- Click Add to bring up Navigation Items Library, and then click Add.
- In the Navigation Item Editor window, specify the name of the item, and set the Target Type to Master/Detail Default Query.
- In the Form section, select the Module and Form that was created in the previous sections.
- In the Action section, add actions to create, update, or delete records, and then click Save & Close.
- Select the menu to add the navigation item.
- Click Navigation Items Library, search the recently created Navigation Item, and then Save & Close.
- Add records to the navigation item by clicking .
OSLC on the Maximo Real Estate and Facilities Server
Creating an OSLC Resource for the BO
Create an OSLC resource for the Business Object. The resource is data that can be identified by a URI.
- Navigate to .
- Click Add.
- Specify the ID, Resource Name, and Title.
- In Namespace the prefix
spi
is used which has the base of http://jazz.net/ns/ism/smarter_physical_infrastructure. The namespace is used to provide unique name to the fields but does not change any logic. You can use any namespace or create your own. - In the Module drop-down menu, select the module that was created earlier. The corresponding BO, Form, and Query are now available for selection.
- In the Properties section, click Import All Fields to set up the fields for the resource based on the BO fields.
- After the import is completed, click Create.
A service provider contains the resources that allow the use of the resource. This also includes the creation of factory and query capability.
- Navigate to .
- Click Add.
- On the Service Provider creation form, specify a name, and then click Create.
- Open the Service Provider created in the previous section.
- Under the Service section, click Add.
- In the new form name the service and set the domain to match what is set in the resource: http://jazz.net/ns/ism/smarter_physical_infrastructure.
- Click Create.
The query capability allows to create a base URI that can be used to query the resources easily.
- In the Query Capabilities section of the service form, click Add to bring up the Query Capability form.
- In the Resource section, click Find.
- Select the OSLC Resource that was created earlier and then click OK.
- In the General section, specify a name and title.Note: If you want to override the query that is added to the resource, you can select the query from the Query drop-down menu. In this example, the query is already added to the resource so leave the Query field blank.
Creating a creation factory provides a URI that can then be used to create new records for resources.
- In the Creation Factories section of the service form, click Add.
- In the Resource section, click Find.
- Select the OSLC Resource that was created earlier and then click OK.
- In the General section, specify a name and title.
Using the Advanced REST client
- The commands follow this format:
https://<workspace_id>.facilities.<mas_domain> - To receive responses that include URIs that you can directly use with the REST Client, you must first set the OSLC_BASE_URI property in the TRIRIGAWEB.properties file. Set the OSLC_BASE_URL property to https://<workspace_id>.facilities.<mas_domain>/oslc, save this file, and then restart your Maximo Real Estate and Facilities server.

After running the command, you might see that the status is 200 OK. It means that the command ran without any errors. Scroll down to see the result in the Response section. The results of the query that was run is displayed. The records that are created are displayed as resources in the command section.
oslc.select and oslc.where. To see the names
assigned in the records, oslc.select can be used for viewing the field values in
the query. For example, running a GET command on:
https://<workspace_id>.facilities.<mas_domain>/oslc/spq/RecordQC?oslc.select=*
shows all the fields in the response for all the records. You can also display a specific field by
replacing the “*” with a specific field to return all the records with that field. To get all the
names assigned in the records, run GET on:
https://<workspace_id>.facilities.<mas_domain>/oslc/spq/RecordQC?oslc.select=*.
. 
You can query a specific field value to return any record that mentions the field by
using oslc.where command. For example, you can run a query on all records with the
word “MREF” anywhere in its description by running GET on the following URI:
http://<workspace_id>.facilities.<mas_domain>/oslc/spq/RecordQC?oslc.select=*&oslc.where=spi:triDescriptionTX="%25MREF%25
oslc.where=spi:triDescriptionTX="%25MREF%25": Displays any records that have “MREF” anywhere in the description."%25string%25"= string anywhere in the field."%25string"= string ends the field."string%25"=string starts the field.

For more information, see OSLC resources.
rdf:about. If you run a GET command on any of these URIs, a list with details is
displayed. On the Advanced REST Client, you can also click the URI to set it. For example, running
the GET command on:
https://<workspace_id>.facilities<mas_domain>/sqa/oslc/so/amRecordRS/20029512.
This provides the response with the information from the record with
specId=20029512. If you click Send, a response is provided
with all the information that is gathered about the record.
All fields that were defined in the resource, including triNumber and triNameTX, are
displayed in the response. You can also use oslc.properties to specify the fields
you want to see in the results. For example if you want to just get the triNumber field, you can run
GET on:
https://<workspace_id>.facilities<mas_domain>/oslc/so/amRecordRS/20029510?oslc.properties=spi:triNumber
- The Accept field is used to determine what file formats the browser is trying to get.
- The Content-Type field helps determine how to use the data being received:
- Header: Accept: application/json
- Content-Type: application/json;charset=utf-8
{"spi:action":"Create Draft","spi:triNameTX":"Tom Tommyson", "spi:triNumber": "42", "spi:triDescriptionTX":
"This record was made using the advanced rest client" }This would create a draft for a
record with the triNameTX field set to Tom Tommyson, the triNumber field to 42, and the triDescriptionTX field to “This record was made using the advanced rest client”.


Use a record that is can be updated by
using the PUT command. The newly created record in the previous section is in the draft state and is
not in the read-only state. You can get the URL for this record by running the query capability
again. For example, you can update the triNumber on the record. The header is same
as from the POST command. To update only the number field, you can set the request body to:
{"spi:triNumber":"24" }
This action changes the number in the record from 42 to the new value 24. Ensure to select PUT before clicking SEND.

You can also delete a record using PUT. To delete a record, run the delete action
that brings the record to the null state. For example, to delete one of the records, run a PUT
command with the request body of: {"spi:action":"Delete"}
Run a DELETE command: https://<workspace_id>.facilities.<mas_domain>/oslc/
You can use the REST Client to login to the Maximo Real Estate and Facilities Server. When you send the first request upon opening the REST Client, you are prompted to specify your username and password. To login or switch users, you can run a GET command on: https://<workspace_id>.facilities.<mas_domain>/oslc/login?USERNAME=name&PASSWORD=pass. Set the USERNAME and PASSWORD parameters to the username and password that you use to login to Maximo Real Estate and Facilities. These login parameters can then be run by using any request.
Another useful command that you can run is to check to see which user account who you
are logged in with. A query capability is already included on the
Maximo Real Estate and
Facilities server and is set up in the
triFriendOfAFriendSV (which can be found in the
triFriendOfAFriendSP) and is called triCurrentUserQC. To see the
user logged in, run a GET command on:
https://<workspace_id>.facilities.<mas_domain>/oslc/spq/triCurrentUserQC?oslc.select=*.
?oslc.select=* is not mandatory but can be used to view the record details
returned.