Technical Blog Post
Abstract
Additional media types supported by Registry Services
Body
Co-authored with Fernando Mariani
With Fix Pack 2, Registry Services provides support for two additional media types:
-
JSON, an open standard based on the JavaScript language, which provides a simple human-readable syntax for representing simple data types.
-
Turtle, designed specifically to represent data in a RDF model, is an alternative to RDF/XML which is able to define any RDF graph in a cleaner model.
How to send requests using Turtle and JSON media types
When you send an HTTP request to Registry Services, you can specify the media type in the HTTP header.
For a POST or PUT request, the Content-Type HTTP header defines the media type in which the resource in the request body is being sent.
For a GET request, the Accept HTTP header defines the media type in which you want to receive the requested resource.
Following are the values that can be used in both the Content-Type and Accept HTTP headers
- JSON: application/json
- Turtle: text/turtle
If you do not specify these headers, Registry Services assumes the default value, which is application/xml.
Supported Services
Turtle and JSON media types are supported in the following services:
-
POST/PUT/GET requests on the Service Provider collection
-
POST/GET/PUT requests on the Registration Record collection
-
GET requests on the Resource Record collection
-
GET/PUT requests on the Resource Shapes collection.
-
POST/GET requests on the Provider Record Template collection.
-
POST/GET requests on the Resource Registry Batch Operations collection
Payload Examples
GET request on a Registration Record with Accept: text/turtle
@prefix rr: <http://jazz.net/ns/ism/registry#> . @prefix oslc: <http://open-services.net/ns/core#> . @prefix dcterms: <http://purl.org/dc/terms/> . @prefix crtv: <http://open-services.net/ns/crtv#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <http://host:9080/oslc/registration/1380889981851> a crtv:ComputerSystem , rr:RegistrationRecord ; rr:sourceRecord <http://kbsys.com/query/recent/devCS1> ; oslc:domain <http://open-services.net/ns/monitoring/1.0/> ; oslc:serviceProvider <http://host:9080/oslc/providers/1380889982057> ; oslc:shortTitle "Computer System 1"^^rdf:XMLLiteral ; crtv:manufacturer "IBM" ; crtv:systemBoardUUID "ident-CS-1" ; dcterms:modified "2013-10-09T17:40:27.329Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
GET request on a Registration Record with Accept: application/json
{ "crtv:manufacturer": "IBM", "crtv:systemBoardUUID": "ident-CS-1", "dcterms:modified": "2013-10-09T14:40:27.329-03:00", "oslc:domain": { "rdf:resource": "http:\/\/open-services.net\/ns\/monitoring\/1.0\/" }, "oslc:serviceProvider": { "rdf:resource": "http:\/\/host:9080\/oslc\/providers\/1380889982057" }, "oslc:shortTitle": "Computer System 1", "prefixes": { "crtv": "http:\/\/open-services.net\/ns\/crtv#", "dcterms": "http:\/\/purl.org\/dc\/terms\/", "oslc": "http:\/\/open-services.net\/ns\/core#", "rdf": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#", "rdfs": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#", "rr": "http:\/\/jazz.net\/ns\/ism\/registry#", }, "rdf:about": "http:\/\/host:9080\/oslc\/registration\/1380889981851", "rdf:type": [ { "rdf:resource": "http:\/\/jazz.net\/ns\/ism\/registry#RegistrationRecord" }, { "rdf:resource": "http:\/\/open-services.net\/ns\/crtv#ComputerSystem" } ], "rr:sourceRecord": { "rdf:resource": "http:\/\/kbsys.com\/query\/recent\/devCS1" } }
You can find more information and provide your comments in the Agile epics:
UID
ibm11275856