Augment Service Content Negotiation

By default the Augment Service returns RSS 1.0; and if there is no accept header or an accept header of "*/*" then it will return RSS 1.0. The augment service supports transcoding between different RDF serialisations, i.e., from RDFXML to TURTLE. For example, if the client specifies accept:text/turtle, the client can provide the Augment Service with data that has a content type of application/rdf+xml.
It does not, however, support transcoding of RSS; if RSS is put in to be augmented then RSS must be returned. For example, if the client specifies accept:application/rss+xml then the client must provide a valid RSS feed with a content-type of application/rss+xml.
The Augment Service can support the following types of RDF:

application/rss+xml (valid RSS 1.0 feeds)
application/rdf+xml
text/turtle

GET

The client must set the data-uri parameter in the querystring to reference an RDF document on the web, e.g., {store}/services/augment?data-uri={uri of document to augment}). The Augment Service has a list of acceptable media types when retrieving a document from the web; these acceptable media types depend upon the Augment Request accept headers as shown below.
Client Accept Header Augment Accept Header for fetch of data-uri
 application/rss+xml    application/rss+xml
 application/xml  application/rss+xml
 */* application/rss+xml
 No accept header application/rss+xml
 application/rdf+xml    application/rdf+xml, text/turtle
 text/turtle    application/rdf+xml, text/turtle
(If the GET request for the data-uri cannot otherwise retrieve the data, then the Platform returns 502 (Bad Gateway) along with an error message. (From status code definition: “The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.” )

POST

The client can POST rdf documents (including RSS 1.0 feeds) to the augment service, or provide a URI to enable the augment service to retrieve an RDF document from the web.
When posting a document the client must set the content-type header for the mime-type of the document posted.

The client should set an accept header for the format the augmentation results should be returned in. These can be:
  • application/rss+xml (This is also the default format if the client sends no accept header or an accept header of */*; the client must provide a valid RSS 1.0 feed to be augmented)
  • application/xml (The Augment Service regards XML as a type of RSS not as a type of RDF/XML; if the client wishes RDF/XML returned then they must set an accept header of application/rdf+xml NOT application/xml)
  • application/rdf+xml
  • text/turtle
If the accept header contains application/rss+xml, application/xml or */* then these will override any other accept header values set and the Augment Service will try and return RSS. For example, for an accept header set of "accept:application/rdf+xml, application/xml" the Augment Service would expect to be provided with a valid RSS 1.0 feed. 

Content Negotiation rules are as follows:

Method Accept Header Content-type of document posted or data-uri fetched Response
POST No headers  application/rss+xml application/rss+xml
POST No headers No content type   HTTP Status 415 (Unsupported type)  
POSTNo headers Differs from application/rss+xml, e.g., application/rdf+xml or text/turtle HTTP Status 406 (Not acceptable)
POST  */*  application/rss+xml application/rss+xml
POST */* No content type HTTP Status 415 (Unsupported type) 
POST */* Differs from application/rss+xml, e.g., application/rdf+xml or text/turtle HTTP Status 406 (Not acceptable)
POST application/rss+xml application/rss+xml application/rss+xml
POST application/rss+xml No content type HTTP Status 415 (Unsupported type)
POST application/rss+xml Differs from application/rss+xml, e.g., application/rdf+xml Http Status 406 (Not acceptable)
POST application/rss+xml */* (Must explicitly set the content-type to be RSS) Http Status 415  (Unsupported type)
POST application/xml application/rss+xml application/xml (A valid RSS 1.0 feed)
POST application/rdf+xml application/rdf+xml application/rdf+xml
POST application/rdf+xml No content type HTTP Status 415 (Unsupported Type)>
POST application/rdf+xml Differs from Accept, e.g., application/rss+xml application/rdf+xml
POST application/rdf+xml */* Http Status 415 (Unsupported type)
POST text/turtle text/turtle text/turtle
POST text/turtle No content type HTTP Status 415 (Unsupported type)
POST text/turtle Differs from Accept, e.g., application/rdf+xml text/turtle
POST text/turtle */* Http Status 415 (Unsupported type)
GET    No headersContent-type header returned from GET of data-uri is application/rss+xml   application/rss+xml  
GETNo headersContent-type header returned form GET of data-uri is NOT application/rss+xml (e.g. it is application/rdf+xml)  Http Status 502 (Transcoding of RSS not allowed)  
GET*/*Content-type header returned form GET of data-uri is application/rss+xml   application/rss+xml   
GET*/*Content-type header returned form GET of data-uri is NOT application/rss+xml (e.g. it is application/rdf+xml)        Http Status  502 (Bad Gateway) (A 406 Not Acceptable will be returned from augment service GET request to data-uri)      
GET application/rss+xml Content-type header returned from GET off data-uri is  application/rss+xml application/rss+xml
GET application/rss+xml Content-type header returned from GET of data-uri not application/rss+xml. Http status 502 (Bad Gateway)
GET application/rss+xml No Content-type header returned from GET Http status 502
GET application/xml Content-type header returned from GET is application/rss+xml application/xml (A valid RSS 1.0 feed)
GET application/xml Content-type header returned form GET NOT application/rss+xml HTTP Status 502
GET application/xml No Content-type header returned from GET Http Status 502
GET application/rdf+xml Content-type header returned from GET of data-uri is application/rss+xml> Http Status  502 (Bad Gateway) (A 406 Not Acceptable will be returned from augment service GET request to data-uri)
GET application/rdf+xml Content-type header returned from GET of data-uri is one of acceptable content-types:  application/rdf+xml, text/turtle application/rdf+xml
GET application/rdf+xml Content-type header returned from GET of data-uri is NOT one of acceptable content types Http Status 502 (Bad Gateway) (A 406 Not Acceptable will be returned from augment service GET request to data-uri)
GET text/turtle Content-type header returned from GET of data-uri is application/rss+xml Http Status  502 (Bad Gateway) (A 406 Not Acceptable will be returned from augment service GET request to data-uri)
GET text/turtle Content-type header returned from GET of data-uri is one of acceptable content-types: application/rdf+xml, text/turtle text/turtle
GET text/turtle Content-type header returned from GET of data-uri is NOT one of acceptable content types Http Status  502 (Bad Gateway) (A 406 Not Acceptable will be returned from augment service GET request to data-uri)


Comments