B.2 PDS-4K JSON RPC remote control

General

JSON (JavaScript Object Notation) is a lightweight format that is used for interchanging data. It is based on a subset of JavaScript language: the way objects are built in JavaScript.

Introduction to JSON

JSON is built on two structures:

Here is an example of JSON data:

{
     "firstName": "John",
     "lastName": "Smith",
     "address": {
         "streetAddress": "21 2nd Street",
         "city": "New York",
         "state": "NY",
         "postalCode": 10021
     },
     "phoneNumbers": [
         "212 555-1234",
         "646 555-4567"
     ]
 }
How JSON interacts with the PDS-4K presentation switcher and Event Master processors

JSON uses JSON RPC (REST based) to interact with the PDS-4K presentation switcher. JSON-RPC is a remote procedure call protocol encoded in JSON.

JSON-RPC works by sending a request to a server implementing this protocol. The client in that case is typically software intending to call a single method of a remote system. Multiple input parameters can be passed to the remote method as an array or object, whereas the method itself can return multiple output data as well.

There are JSON RPCs defined to perform tasks on the PDS-4K presentation switcher. User needs to send JSON request through their application or open source application like Postman.

These applications should send request on IP, where the PDS-4K presentation switcher is running and fixed port 9999 (Webserver of the PDS-4K presentation switcher is running on port 9999).

Use JSON from the web application

To use the JSON APIs from the web application, select the Settings icon on the Menu navigation bar, and select JSONRPC API from the web app dashboard.

Image B–1 Use JSON from the web application
Postman

Postman is an application that you can use to test the Event Master JSON API.

  1. Go to the GetPostman website.

    (https://www.getpostman.com/)

  2. Download the free Postman app.
  3. Install Postman on your machine.
  4. Launch Postman and follow these steps to send JSON commands to the Event Master processor.

    1. Select POST from the dropdown next to the URL text box.
    2. Enter the request URL with port 9999.
    3. Type “Content-Type” for header and “application/json” as value of this header.

      (See https://www.getpostman.com/docs/requests for more information on sending requests.)

      Image B–2 Content-Type and application/json
  5. Select Body and click on raw from the buttons available below the URL text box.
  6. Write the request in the body.

A request is a call to a specific method provided by a remote system. It must contain three certain properties:

The receiver of the request must reply with a valid response to all received requests. A response must contain the properties mentioned below.

For example: {"params":{}, "method":"powerStatus", "id":"1234", "jsonrpc":"2.0"}

Image B–3 powerStatus API – example

Here, powerStatus is the JSON API to be sent.

JSON APIs

Here are some of the JSON APIs defined for controlling the PDS-4K presentation switcher. If you have a host / client Event Master setup, JSON must be sent to the host unit. For all the requests, this section explains the parameter passed or used in the RPC calls. If the params object is blank that means that API doesn’t require a parameter.

Note: Requests are case sensitive.

allTrans

 

cut

 

resetFrameSettings

 

powerStatus

 

listPresets

 

listDestinationsForPreset

 

savePreset

 

renamePreset

 

activatePreset

 

recallNextPreset

 

deletePreset

 

listDestinations

 

listSources

 

listContent

 

activateCue

 

activateDestGroup

 

listCues

 

changeContent

 

listStill

 

deleteStill

 

takeStill

 

getFrameSettings

Subscription and Un-Subscription

When a subscription is done from a JSON-based application, a notification is sent to the ip port where the application is running when there is change for which the user has subscribed.

Actual notification is sent asynchronously as an HTTP Post, with the following structure: {result: {method:

"notification",notificationType: "ScreenDestChanged",change: { add: [2],

remove: [], update: [0, 1, 2] }}}.

The change field contains the XmlId(s) of the screens that were added/removed or updated.

Note: All subscriptions are lost once the Event Master processor is restarted, and they must be subscribed again if required.

subscribe

 

unsubscribe