RPC

From ago control wiki
(Difference between revisions)
Jump to: navigation, search
(Receive Events)
(RPC Interface)
Line 2: Line 2:
 
ago control provides a RPC interface. It is implemented in the agorpc daemon. It is written in C++ and uses the [http://code.google.com/p/mongoose/ mongoose embedded web server] to provide an HTTP interface on port 8008. Be sure that the RPC service is running else start it:
 
ago control provides a RPC interface. It is implemented in the agorpc daemon. It is written in C++ and uses the [http://code.google.com/p/mongoose/ mongoose embedded web server] to provide an HTTP interface on port 8008. Be sure that the RPC service is running else start it:
 
  systemctl start agorpc.service
 
  systemctl start agorpc.service
 
+
== HTTP GET requests  ==
 
The following calls are supported:
 
The following calls are supported:
== Inventory ==
+
=== Inventory ===
 
The inventory can be fetched as JSON structure with the following command request:
 
The inventory can be fetched as JSON structure with the following command request:
 
  http://x.y.z:8008/command?command=inventory
 
  http://x.y.z:8008/command?command=inventory
  
== Send commands ==
+
=== Send commands ===
 
Other commands work the same, e.g. to switch on a lamp:
 
Other commands work the same, e.g. to switch on a lamp:
 
  http://x.y.z:8008/command?command=on&uuid=91926587-03c6-4cfa-898c-4d5ad75fc494
 
  http://x.y.z:8008/command?command=on&uuid=91926587-03c6-4cfa-898c-4d5ad75fc494
Line 16: Line 16:
 
  http://x.y.z:8008/command?command=getepg&uuid=4a79ce72-7cfe-4b12-bfc5-dfd30bb297f4
 
  http://x.y.z:8008/command?command=getepg&uuid=4a79ce72-7cfe-4b12-bfc5-dfd30bb297f4
  
== Receive Events ==
+
=== Receive Events ===
 +
This GET request will stay open and stream any incoming event:
 
  http://x.y.z:8008/update
 
  http://x.y.z:8008/update
 +
== JSON-RPC interface ==
 +
You can find more information regarding JSON-RPC here: http://www.jsonrpc.org/specification
 +
 +
Please be aware that batches don't work yet. The following methods are implemented:
 +
=== message ===
 +
The message method will send an AMQP message to ago control with "content" as content. This example will switch off a specific uuid:
 +
{"jsonrpc" : "2.0", "method" : "message", "params" : {"content":{"command":"off", "uuid":"0962f27e-99ce-43a4-872b-97d75d61f464"}}, "id":"eins" }
 +
To send an event also add a "subject" parameter to "params".

Revision as of 17:51, 20 December 2012

Contents

RPC Interface

ago control provides a RPC interface. It is implemented in the agorpc daemon. It is written in C++ and uses the mongoose embedded web server to provide an HTTP interface on port 8008. Be sure that the RPC service is running else start it:

systemctl start agorpc.service

HTTP GET requests

The following calls are supported:

Inventory

The inventory can be fetched as JSON structure with the following command request:

http://x.y.z:8008/command?command=inventory

Send commands

Other commands work the same, e.g. to switch on a lamp:

http://x.y.z:8008/command?command=on&uuid=91926587-03c6-4cfa-898c-4d5ad75fc494

Set level for a dimmer:

http://x.y.z:8008/command?command=setlevel&uuid=c2467e36-817e-4b63-a274-0cc23e550965&level=50

Fetch the electronic program guide from a Dreambox/Engima2:

http://x.y.z:8008/command?command=getepg&uuid=4a79ce72-7cfe-4b12-bfc5-dfd30bb297f4

Receive Events

This GET request will stay open and stream any incoming event:

http://x.y.z:8008/update

JSON-RPC interface

You can find more information regarding JSON-RPC here: http://www.jsonrpc.org/specification

Please be aware that batches don't work yet. The following methods are implemented:

message

The message method will send an AMQP message to ago control with "content" as content. This example will switch off a specific uuid:

{"jsonrpc" : "2.0", "method" : "message", "params" : {"content":{"command":"off", "uuid":"0962f27e-99ce-43a4-872b-97d75d61f464"}}, "id":"eins" }

To send an event also add a "subject" parameter to "params".

Personal tools