Skip to content
Jose Romaniello edited this page Jul 12, 2011 · 5 revisions

Administration API

This is a brief explanation of the RESTfulie API that Hermes uses. Remember that if you want to see a general purpose Hermes client in c# you can digg the Hermes.Client project in this same repository.

Groups

To create a group, the only thing you have to do is to POST to "http://YourHermesUrl/groups" a message like this:

<Group xmlns="http://schemas.datacontract.org/2004/07/TellagoStudios.Hermes.RestService.Facade">
    <name>My brand new group</name>
    <description />
</Group>

Then you will get a response message like this without content:

HTTP/1.1 201 Created
Location: http://YourHermesUrl/groups/4e15b4d317b6c41228ba0174

Now, if you do a GET of the location header, you will get something close to this:

<?xml version="1.0" encoding="utf-8"?>
<Group xmlns="http://schemas.datacontract.org/2004/07/TellagoStudios.Hermes.RestService.Facade">
  <id>4e15b4d317b6c41228ba0174</id>
  <name>My brand new group</name>
  <description />
  
  <links>
    <link uri="http://YourHermesUrl/topics" 
          rel="Create Topic"
          mediaType="application/vnd.hermeshub+xml" />
    
    <link uri="http://YourHermesUrl/groups/4e15b4d317b6c41228ba0174/topics"
          rel="All Topics" 
          mediaType="application/vnd.hermeshub+xml" />
    
    <link uri="http://YourHermesUrl/groups/4e15b4d317b6c41228ba0174"
          rel="Delete" 
          mediaType="application/vnd.hermeshub+xml" />
    
    <link uri="http://YourHermesUrl/groups/4e15b4d317b6c41228ba0174"
          rel="Update" 
          mediaType="application/vnd.hermeshub+xml" />
  </links>
</Group>

The links collection has all the operations you can do with a Group.

Topics

To create a topic, a Hermes client have to follow the "Create Topic" relation of the Group header by doing a POST with a payload like this:

<topic xmlns="http://schemas.datacontract.org/2004/07/TellagoStudios.Hermes.RestService.Facade">
    <name>Weather</name>
    <description>information about the wheater</description>
    <groupId>4e15b4d317b6c41228ba0174</groupId>
</topic>

Then, as usual, you will get a response message like this without content:

HTTP/1.1 201 Created
Location: http://YourHermesUrl/topics/4e15b4a617b6c41228ba0173

if you dereference the location header, you will get this:

<?xml version="1.0" encoding="utf-8"?>
<Topic xmlns="http://schemas.datacontract.org/2004/07/TellagoStudios.Hermes.RestService.Facade">
  <id>4e15b4a617b6c41228ba0173</id>
  <name>Weather</name>
  <description />
  
  <links>
    <link uri="http://YourHermesUrl/groups/4e15b4d317b6c41228ba0174"
        rel="Group" 
        mediaType="application/vnd.hermeshub+xml" />
    
    <link uri="http://YourHermesUrl/topics/4e15b4a617b6c41228ba0173"
        rel="Delete" 
        mediaType="application/vnd.hermeshub+xml" />
    
    <link uri="http://YourHermesUrl/topics/4e15b4a617b6c41228ba0173"
        rel="Update" 
        mediaType="application/vnd.hermeshub+xml" />
          
    <link uri="http://YourHermesUrl/messages/topic/4e15b4a617b6c41228ba0173"
        rel="Post Message" 
        mediaType="application/vnd.hermeshub+xml" />
        
    <link uri="http://YourHermesUrl/feed/4e15b4a617b6c41228ba0173"
        rel="Current Feed" 
        mediaType="application/vnd.hermeshub+xml" />
  </links>
</Topic>

The two more important links you can see here are "Post Message" and "Current Feed". These two links are the Publish and Subscribe links respectively.