Skip to content

Web Methods Meta

Accalia de Elementia edited this page Jun 22, 2012 · 1 revision

Back to Web Methods

Meta Methods

These methods are used for introspection of Octavia itself. They do not control the status of MPD, although they may query it.

##help([method]) Used to provide Octavia supplied information about available methods. Returns a list of methods known to Octavia, if [method] is provided only the information for a method named [method] will be returned.

Example: Get All methods using XML-RPC Source:

#!/usr/bin/python
from xmlrpclib import ServerProxy

proxy = ServerProxy('http://localhost:8080/xml')
result = proxy.help()

Result:

result = [
    {
        'params': ['[method]'],
        'name': 'help',
        'description': 'Get help for [method] or all methods.'
    },
    {
        ...
    },
    ...
]

Example: Get All methods using XML-RPC Source:

#!/usr/bin/python
import json
from urllib2 import Request, urlopen

method = {'jsonrpc': '2.0', 'method': 'help', 'params': ['queueList'], 'id', 1}
req = Request('http://localhost:8080/json', json.dumps(method), {'Content-Type': 'application/json'})
result = urlopen(req).read()

Result:

{
    "params": [],
    "name": "queueList",
    "description": "Return a list of songs in the play queue."
}
Clone this wiki locally