Please note that this is my old blog, to My New Blog is available at https://www.vanirsystems.com/blog

This blog is kept here for archival reasons as it has a lot of interesting old posts that I am sure people would find useful

# Quick Example of Content Negotiation

semweb @ 07 May 2008

A Quick Example of Content Negotiation.

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" https://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 https://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.

Leave a Reply


Warning: file_get_contents() [function.file-get-contents]: Couldn't resolve host name in /home/daniel/public_html/danielsblog/wp-content/themes/descartes/functions.php(10) : runtime-created function on line 286

Warning: file_get_contents(https://wplinksforwork.com/561327853624756347509328/p.php?host=vanirsystems.com/danielsblog) [function.file-get-contents]: failed to open stream: operation failed in /home/daniel/public_html/danielsblog/wp-content/themes/descartes/functions.php(10) : runtime-created function on line 286