JSON-RPC API: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Wilco
(added JSONRPC namespace descriptions)
>Wilco
(Added Player Namespace details)
Line 54: Line 54:
Send a message to other clients
Send a message to other clients
<pre>
<pre>
PARAMETERS
PARAMETERS
sender            string    the sender of the announcement (your client name)
sender            string    the sender of the announcement (your client name)
message            string    description of the announcement
message            string    description of the announcement
data              object    OPTIONAL: data associated with this message
data              object    OPTIONAL: data associated with this message
</pre>
== Player ==
=== Player.GetActivePlayers ===
Returns which players are active
<pre>
RESULT
video              boolean    True if video is playing, false otherwise
audio              boolean    True if audio is playing, false otherwise
picture            boolean    True if pictures are playing, false otherwise
</pre>
</pre>

Revision as of 23:24, 19 September 2010

Overview

JSON RPC is a HTTP-based interface for communicating with XBMC. It replaces the now-depreceated HTTP API, and offers a more secure and robust mechanism in the same format. It is based upon the JSON RPC 2.0 specification.


Enabling JSON RPC

TODO: add detail and check
To enable the JSON RPC interface in XBMC the "Allow External Control of XBMC" option must be enabled in the settings page. To control XBMC from other computers the "Allow Control from other computers" must also be enabled.

Note: The EventServer is a different interface for sending remote keypresses to XBMC, and must be enabled separately, some programs may use both interfaces.


XBMC API

The XBMC JSON api is split up into namespaces, which contain methods that can be called. These namespaces are:

JSONRPC          A variety of standard JSONRPC calls
Player           Manages all available players
MusicPlayer      Audio playback control
VideoPlayer      Video playback control
Slideshow        Picture playback control
Playlist         Playlist Modification
Files            Shares information
MusicLibrary     Audio Library Information
VideoLibrary     Video Library Information
System           System Controls and Information
XBMC             Application controls

JSONRPC

JSONRPC.Introspect

Returns a list of all available method calls

PARAMETERS
getpermissions     boolean    OPTIONAL: return list of required permissions
getdescriptions    boolean    OPTIONAL: return list of method descriptions
filterbytransport  boolean    OPTIONAL: Return only methods available on this transport

JSONRPC.Version

Returns the version of this API (not JSONRPC version)

JSONRPC.Permission

Returns a list of client permissions

JSONRPC.Ping

Returns pong!

JSONRPC.GetAnnouncementFlags

Returns what announcements the client is listening for

JSONRPC.SetAnnouncementFlags

Sets what announcements the client is listening for

JSONRPC.Announce

Send a message to other clients


PARAMETERS
sender             string     the sender of the announcement (your client name)
message            string     description of the announcement
data               object     OPTIONAL: data associated with this message

Player

Player.GetActivePlayers

Returns which players are active

RESULT
video              boolean    True if video is playing, false otherwise
audio              boolean    True if audio is playing, false otherwise
picture            boolean    True if pictures are playing, false otherwise