Cheat sheet¶
Everything on this page was verified on Polarion 2612. Follow the links for the details.
URLs¶
| What | URL |
|---|---|
| Static files of an application | https://<host>/polarion/apps/<identifier>/<rootDirectory>/<file> |
| View entry (redirects to the view's document) | https://<host>/polarion/apps/<identifier>/views/<viewId> |
| Application endpoint | https://<host>/polarion/apps/<identifier>/rest/<urlPath> |
| REST API | https://<host>/polarion/rest/v1/… |
| Navigation topic page | https://<host>/polarion/#/project/<projectId>/<identifier>.<viewId> |
| Work Items table with a sidebar open | …/#/project/<projectId>/workitems?sidebar=polarion-application.<identifier>.<viewId> |
| SDK download | https://<host>/polarion/sdk/applications/polarion-app-sdk-0.5.2-preview.tgz |
Configuration XML¶
<!-- Form layout: Project Administration → Work Items → Form Configuration → Form Layouts -->
<applicationView id="<identifier>.<viewId>" label="Panel heading" height="480px"/>
<!-- Topics: Project Administration → Portal → Topics → <View> -->
<applicationView id="<identifier>.<viewId>"/>
<!-- Sidebars: no XML; listed in Show Sidebar automatically -->
Package layout¶
- <identifier>.zip
- <identifier>/ one top-level folder, named after the identifier
- manifest.json
- <rootDirectory>/ per view, or shared by several views: index.html + assets (relative URLs)
- server-scripts/ only with serverScripts.endpoints
- <identifier>/ one top-level folder, named after the identifier
Server settings¶
# Global Administration → Configuration Properties (global configuration property)
polarionapp.enabled=true # Applications feature
# polarion.properties (restart required)
com.siemens.polarion.rest.enabled=true # REST API (else 503)
com.siemens.polarion.rest.security.restApiToken.enabled=true # token for views (else warning dialog, 401)
SDK¶
import { fetchContext, events, EventTypes, destroy } from 'polarion-app-sdk';
const context = await fetchContext(); // 5 s timeout outside Polarion
const stop = events.subscribe(EventTypes.SELECTION_CHANGED, ({ selectedWorkItemIds }) => {});
stop(); destroy(); // on unmount
context.restBaseUrl and context.appEndpoint have no trailing slash. workItemId is project-local (DP-477); selectedWorkItemIds and selection events carry the project (drivepilot/DP-477).
REST call¶
fetch(`${context.restBaseUrl}/projects/${p}/workitems/${id}?fields[workitems]=id,title,status`, {
headers: { 'X-Polarion-REST-Token': context.restToken!, Accept: 'application/json' },
});
Sparse field sets also filter relationships: fields[linkedworkitems]=role,suspect,workItem.
Endpoint rules¶
- Every call carries
objectId(PROJECT/WI-ID), in the query string (GET) or the body (POST). - POST bodies are flat objects with string values; encode lists as JSON strings.
arguments.getAsString('x')throws for an absent parameter; guard optional ones.- Inside a function,
argumentsis JavaScript's own; captureconst scriptArguments = arguments;at the top. - Save what you change:
wi.save()for fields,comment.save()for a new comment. - The last expression is the response; an
errorkey makes it an error (HTTP 400 with the envelope).
const trackerService = context.scriptContext().services().tracker();
const scriptArguments = arguments;
let result = {};
try {
const [projectId, wiId] = scriptArguments.getAsString('objectId').split('/');
const wi = trackerService.getWorkItem(projectId, wiId);
result = { id: wi.getId(), title: wi.getTitle() };
} catch (e) {
result = { error: 'my-endpoint failed: ' + e };
}
result;
Upload dialog¶
Install: identity + SHA-2 hash (128 hex digits). Update: New Version next to Current Version. Delete: immediate, no visible confirmation.