The communication path from the client device (HHP) to the TV application is provided via the REST interface. The following calls are designed to be a generic set of communication APIs that allow developers to define the content of the messages, while providing a structured protocol easily understood by the server (TV).
Each of the following requests includes a URI that contains an {appID}, which is required to communicate with the corresponding TV application.
Note: appID is an unique TV application ID issued by Samsung Apps.
| Resource |
Operation |
HTTP method and URI |
|---|---|---|
GET /ws/app/{appID}/info |
||
POST /ws/app/{appID}/connect |
||
POST /ws/app/{appID}/disconnect |
||
POST /ws/app/{appID}/queue |
||
GET /ws/app/{appID}/queue/device/{deviceID} |
||
POST /ws/app/{appID}/queue/group/{groupID}/join |
||
POST /ws/app/{appID}/queue/group/{groupID}/leave |
||
GET /ws/app/{appID}/queue/group/{groupID} |
||
POST /ws/app/{appID}/queue |
| Header |
Description |
Required |
|---|---|---|
SLDeviceID |
This header contains the DeviceID used to identify the client device and the corresponding TV application. |
YES (for ALL requests except Get Application Info request) |
Content-type |
This header refers to the content type of the request. The value for this header can be either JSON or XML. |
YES (for POST requests only) |
ProductID |
This header is only required for Device Connect requests. The value MUST begin with "SMART" and be exactly 8 characters long. Example: SMARTTVI,SMARTDev |
YES (for Connect requests only) |
VendorID |
This header is only required for Device Connect requests. The value must be exactly 8 characters long. |
YES (for Connect requests only) |
DeviceName |
This header is only required for Device Connect requests. This header contains the name of the client device. The value MUST be less than 64 characters long. |
YES (for Connect requests only) |
User-Agent |
This header is used by the TV to identify the type of the client device and its capabilities. |
YES (for ALL requests) |
Custom (User-Defined) |
The developer can add any other headers needed for proper performance of their application. Any custom headers added to a request are included as the second parameter in the message context (JSON object) |
NO |
This request retrieves the following information related to the application ID included in the request.
This is a system message and the message format is predefined in JSON format.
| HTTP method and URI |
|
|---|---|
Syntax |
Request type: GET |
Return value |
200 OK |
Parameter |
appID (Application ID) |
Example |
Sample request: |
This request initiates the connection between the client application and the TV application. Client must provide the following headers with the request:
| HTTP method and URI |
|
|---|---|
Syntax |
Request Type: POST |
Return value |
200 OK (connection request is accepted) |
Parameter |
appID (Application ID) |
Example |
Sample request: Sample response: |
This request disconnects the mobile application from the TV application.
| HTTP method and URI |
|
|---|---|
Syntax |
Request type: POST |
Return value |
200 OK (disconnect request is accepted) |
Parameter |
appID (Application ID) |
Example |
Sample request: Sample response: |
Each of the following requests is designed to communicate directly with the message queueing system on the TV. These REST APIs are limited to either pushing a message onto the queue or popping (removing) a message from the queue.
This request pushes a TV application message onto the message queue in the TV. Any message sent to the following URI only goes to the TV application.
Note: The message body included in this request is determined by the developer of the application.
| HTTP method and URI |
|
|---|---|
Push message (to TV App): To send application data to TV App |
|
Syntax |
Request type: POST |
Return value |
200 OK (message sent to application) |
Parameter |
appID (Application ID) |
Example |
Sample request: |
If the message queue is not empty, this request retrieves a message from the device's message queue on the TV. If the message queue is empty, this request is be held until the message arrives or the request times out (long polling). Status code 408 is returned upon long polling time out. The client must initiate another pop message request immediately when it receives 408.
| HTTP method and URI |
|
|---|---|
Push message (from TV App): To get application data from TV App |
|
Syntax |
Request type: GET |
Return value |
200 OK (message sent to application) |
Parameter |
appID (Application ID) |
Example |
Sample request: |
This request is sent to inform the TV that the device wants to join a particular group.
| HTTP method and URI |
|
|---|---|
Syntax |
Request type: POST |
Return value |
200 OK (joining request accepted) |
Parameter |
appID (Application ID) |
Example |
Sample request: |
This request is sent to inform the TV that the device wants to leave a particular group.
| HTTP method and URI |
|
|---|---|
Syntax |
Request type: POST |
Return value |
200 OK (leaving request accepted) |
Parameter |
appID (Application ID) |
Example |
Sample request: Sample response: |
This request retrieves a list of all devices currently joined to a particular group.
| HTTP method and URI |
|
|---|---|
Syntax |
Request type: GET |
Return value |
200 OK (request is fulfilled and the result is in the body) |
Parameter |
appID (Application ID) |
Example |
Sample request: |
It is also possible to send files to the corresponding TV application. In these requests, the content type must be multipart form data. Multiple messages and files may be sent together. Each message has a separate callback on the TV application. Client devices can then access the uploaded files through the following URI: /ws/app/{appID}/file/{filename}.
The size limit for single uploaded file and total uploaded files is 3MB. All the uploaded files will be cleaned up when the TV application quits execution.
This request sends a message containing the file data to the message queue on the TV.
Content type must be Multipart form data. Multiple messages and files can be sent together. Each message will be a separate callback on application. Files are saved and served through URI: /ws/app/{appID}/file/{filename}.
| HTTP method and URI |
|
|---|---|
Syntax |
Request type: POST |
Return value |
200 OK |
Parameter |
appID (Application ID) |
Example |
Sample request: |