Requesting Compact Resources Using Headers
The Windchill RV&S OSLC Server supports compact representation for preview of Windchill RV&S resources. The server provides URIs for small preview, icons, ID, and title of the Windchill RV&S resources when an OSLC client application requests discovery of compact resources.
The Windchill RV&S OSLC Server provides support for compact resources as per the Header of the requests received from the OSLC client applications. OSLC client applications can send a GET request with the following headers for discovering compact resources:
• Accept Header
• Link Header
• Prefer Header
Accept Header
If the Windchill RV&S OSLC Server receives a GET request for a resource from the OSLC client application with the Accept header specified as application/x-oslc-compact+xml, the response for such GET request includes application/x-oslc-compact+xml as the content type for the Accept header. This indicates that the client has requested compact representation for a resource.
|
The Windchill RV&S OSLC Server supports application/x-oslc-compact+xml as the content type for allowing OSLC client applications to use content negotiation to access the Compact resource, as per OSLC Core Version 2.0.
|
To discover compact resources using the Accept header, OSLC client applications can use the HTTP Accept header with the application/x-oslc-compact+xml content type for requesting the Compact resource representation for a URI. The client application must set the Accept Header with value as application/x-oslc-compact+xml when sending the GET request.
The Windchill RV&S OSLC server provides compact resources for the supported resources, in the body of the response of such requests. The compact resources are provided in the rdf+xml content type.
Link Header
If the Windchill RV&S OSLC Server receives a GET request for a resource from the OSLC client application with value of the Accept header specified as application/ld+json, the response for such GET request is provided in the ld+json content type and includes the Link header. The value of the Link header in the response provides the following:
• Target URI of the compact resource
For example, https://localhost:3001/oslc/r/requirements?id=15&compact
• Link relation (http://open-services.net/ns/core#Compact)
This indicates that compact representation is available for the specified resource.
To discover compact resources using the Link header, OSLC client applications must set the Accept header to application/ld+json when sending the GET request on a resource. If the request is successful, the value of the Link header in the response provides the target URI of the compact resource and the link relation.
For example:
<https://localhost:3001/oslc/r/requirements?id=15&compact>; rel="http://open-services.net/ns/core#Compact"
The OSLC client application must then send a GET request to the Windchill RV&S OSLC Server using the target URI of the compact resource for discovering the small preview.
For example:
GET https://localhost:3001/oslc/r/requirements?id=15&compact
The OSLC client application must specify the content type for the response using the Accept header when sending the GET request with the target URI. The Windchill RV&S OSLC Server supports application/ld+json and application/rdf+xml as the content type for such request responses.
Prefer Header
If the Windchill RV&S OSLC Server receives a GET request for a resource from the OSLC client application with Prefer header set to return=representation; include="http://open-services.net/ns/core#PreferCompact", the response for such GET request includes the compact resources in the body of the response of such requests. The response also includes Preference-Applied header set to return=representation. The Windchill RV&S OSLC Server supports application/ld+json and application/rdf+xml as the content type in the response for such request.
To discover compact resources using the Prefer header, OSLC client applications must set the Prefer header to return=representation; include="http://open-services.net/ns/core#PreferCompact" when sending the GET request on a resource. The GET request should also include the Accept header in the request. If the client application needs response in ld+json content type, then the Accept header must be set to application/ld+json. If the client application needs response in rdf+xml content type, then the Accept header must be set to application/rdf+xml.