Daniel Lewis

Daniel Lewis - Blog Banner

Quick Example of Content Negotiation

May 7th, 2008 by daniel

A Quick Example of .

Requires the curl command line tool, but can be done using any http fetch tool.

Here is the command for getting RDF/XML:

$ curl -I -H "Accept: application/rdf+xml" http://myopenlink.net/dataspace/person/danieljohnlewis#this

Here is the output:

HTTP/1.1 200 OK
Server: Virtuoso/05.00.3028 (Linux) i686-generic-linux-glibc23-32 VDB
Connection: Keep-Alive
Date: Wed, 07 May 2008 15:23:16 GMT
Accept-Ranges: bytes
Content-Length: 0
ETag: "6689-2008-05-07T11:23:16.000000-0-9851f9cbda1201e253939e204e596f4d"
Content-Type: application/rdf+xml

Here is the command without specifying which MIME Type:

$ curl -I http://myopenlink.net/dataspace/person/danieljohnlewis#this

Here is the output:

HTTP/1.1 200 OK
Server: Virtuoso/05.00.3028 (Linux) i686-generic-linux-glibc23-32 VDB
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Date: Wed, 07 May 2008 15:23:47 GMT
Accept-Ranges: bytes
X-XRDS-Location: yadis.xrds
Content-Length: 0

Summary

This example quickly shows Content Negotiation, it id done by querying Myopenlink.net/ods (an installation of OpenLink Virtuoso Universal Server).

If you actually want to get the response then remove the -I from the command line flags.

No Comments

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave A Comment