Find Panels¶
Whenever user interaction is required, a panel for the user interface is required. In order to avoid creating new panels repeatedly, the SEAL Operator API offers endpoints for listing and searching for existent panels.
All calls to these endpoints are GET requests and support query parameters to search for any panel properties. For details, refer to the OpenAPI specification.
Example - endpoint URL for listing all panels
/v1/panels
The result contains an array of panel objects. For more information, refer to Panels.
For searching for panels with a specific property, the name and the value of the property may be added as query parameter to the endpoint URL. Note that both name and value have to be URL-encoded.
Example - endpoint URL for listing all panels with the name
property set to Shopping Cart
/v1/panels?name=Shopping%20Cart
The result contains an array with all panels having the name Shopping Cart
.
Code Examples¶
Bash¶
#!/bin/bash
if [ -z $1 ]; then
echo "Please call with panel name as parameter"
exit 0
fi
# !Assuming $TOKEN contains a valid JWT access token!
AUTH="Authorization: Bearer $TOKEN"
JSON="Content-Type:application/json"
# list all panels
curl -k -s -X GET -H "$AUTH" -H "$JSON" "https://localhost:3008/v1/panels" | jq .
# find panels with name "Shopping Cart"
NAME=$(echo -n $1 | jq -sRr @uri)
curl -k -s -X GET -H "$AUTH" -H "$JSON" "https://localhost:3008/v1/panels?name=$NAME" | jq .
JavaScript¶
'use strict';
const request = require('request-promise-native');
const listPanels = async function(token, name) {
// list all panels
let req = {
url: 'https://localhost:3008/v1/panels',
headers: {
Authorization: `Bearer ${token}`
},
resolveWithFullResponse: true,
json: true,
strictSSL: false
};
let res = await request.get(req);
console.log(JSON.stringify(res.body, null, 2));
// find all panels with given name
req = {
url: `https://localhost:3008/v1/panels?name=${encodeURIComponent(name)}`,
headers: {
Authorization: `Bearer ${token}`
},
resolveWithFullResponse: true,
json: true,
strictSSL: false
};
res = await request.get(req);
console.log(JSON.stringify(res.body, null, 2));
};