Using the HCL Compass OSLC CM REST API
The HCL Compass OSLC 1.0 and OSLC 2.0 REST API is a RESTful (Representational State Transfer) interface that adheres to the Open Services for Lifecycle Collaboration (OSLC) 1.0 and 2.0 Core and Change Management (CM) specifications.
If you are familiar with HCL Compass OSLC
1.0, you are able to upgrade to the OSLC 2.0 APIs. There are some important differences:
- HCL Compass OSLC 2.0 XML responses are
now RDF/XML. A library for parsing RDF makes these responses much easier to work with. HCL Compass supports RDF/XML (
application/rdf+xml
) and JSON (application/json
) content for all resources. For queries, HCL Compass supports Atom (application/atom+xml
), and for records, it supports HTML (text/html). Content is negotiated by using the HTTP Accept request header as defined in RFC 2616. To request RDF/XML content, use this request header.Accept: application/rdf+xml
You can request more than one content type in theAccept
header. For instance,Accept: text/html,application/atom+xml
You can also request content by using thercm.contentType
parameter. The value ofrcm.contentType
is always used if supplied, no matter what value is present in theAccept
header. However, it is best to use the HTTP Accept header for compatibility with other OSLC-CM providers. If no content type is requested that uses either theAccept
header orrcm.contentType
, RDF/XML is returned.Note: If you want to use RDF/XML, HCL Compassstrongly recommends using a library for parsing RDF such as Jena, a Java™ framework for semantic web applications. This is easier and less error-prone than trying to parse responses as XML. - You no longer must use a special content type to request standard OSLC field values. HCL CompassOSLC 2.0 RDF/XML and JSON responses contain both standard OSLC ChangeRequest properties and HCL Compass (CQ) field values.
- You must include all field values in a PUT request, not just the fields you want to update, if
you don't set the
parameter. See Working with Records: PUT.oslc.properties
- CQ OSLC 2.0 has a different query URL for each record type. The
rcm.type
parameter is no longer required for queries. - Many namespaces and parameter names are changed. See the OSLC-CM 2.0 Specification.
Note: You can use the Compass OSLC 2.0 CM REST API to
programmatically run all Compass functions except adding an
attachment to a record. In HCL Compass, you
must use the HCL Compass OSLC 1.0 CM REST API to add a
record attachment.