Skip to content

Create a Panel


A panel is created by a POST request to the endpoint for creating panels. The request body contains the properties and metadata as described in Panels.


With creating a task panel, the serviceId property has to match the name of the service for which the task was created and the taskId property has to contain the tid of the task which has to be created before. If the createpanel property has been set to 1 (number), the server causes the active session(s) of the user to open the new panel in the user interface. This allows remote controlled panels to be opened.

Example - endpoint URL for creating a panel

/v1/panels

The result contains the created panel. For more information, refer to Panels.


Code Examples

Bash

Run the Create a Task example first and call the script with the returned taskId.

#!/bin/bash

if [ -z $1 ]; then
  echo "Please call with task id as parameter"
  exit 0
fi

# !Assuming $TOKEN contains a valid JWT access token!
AUTH="Authorization: Bearer $TOKEN"
JSON="Content-Type:application/json"

# create panel
PANEL=$(jq -c -n '{
  "createpanel": 1,
  "name":"my panel",
  "type":"print",
  "serviceId": "operator-p4",
  "taskId": "'$1'"
}')
curl -k -s -X POST -H "$AUTH" -H "$JSON" -d "$PANEL" "https://localhost:3008/v1/panels" | jq .

JavaScript

Run the Create a Task example first and call the function with the returned taskId.

'use strict';

const request = require('request-promise-native');

const createPanel = async function(token, taskId) {
  let req = {
    url: `https://localhost:3008/v1/panels`,
    headers: {
      Authorization: `Bearer ${token}`
    },
    body: {
      createpanel: 1,
      name: 'my panel',
      type: 'print',
      serviceId: 'operator-p4',
      taskId
    },
    resolveWithFullResponse: true,
    json: true,
    strictSSL: false
  }
  let res = await request.post(req);
  console.log(JSON.stringify(res.body, null, 2));
};

Back to top