Command Protocol

The command protocol specifies the structure of all commands and their replies.

The command request consists of a header, specifying the command, the version, user-credentials (you got this from your login), a magic followed by the command content. The command content is an array of key/value pairs of type string. Values can be arrays of key/value pairs themselves.

The command response consists of the same header without user-credentialsplus a status return code and the response content as an array of key/value pairs. Values can be arrays of key/value pairs themselves. A retruncode of 0 is assumed to mean "OK". Any command may use any int16-type numbers different from 0 to signal errors and may fill the "returntext" field accordingly.

There's no need to have more semantic information in the protocol.

Example request in any syntax:

{
  { magic : otsrequest }
  { majorversion : 1 }
  { minorversion : 1 }
  { usercred : string }
  { command : getProps }
  { params :
    { propsKey : Drupal }
  }
}

Example response:

{
  { magic : otsresponse }
  { majorversion : 1 }
  { minorversion : 1 }
  { command : getProps }
  { returncode : 0 }
  { returntext : ok }
  { params :
    { p1 :
      { propsId : 231 }
      { propsValue : uid }
    }
    { p2 :
      { propsId : 248 }
      { propsValue : nid }
    }    
  }
}

In this example we requested the props we used to connect the Drupal UserId and NodeId to ots-Users and ots-groups. Now we can retrieve the ots-Users by passing in the command getUsersByProps.

Comments

Actually this is only an example and is not the real response-schema to getProps!