WebAPI

Tasks

Tasks are what Singleshot is about.

To create a new task, send a POST request to /tasks with the following attributes:

The task title is required, and at least one potential owner that can perform the task. If there’s only one potential owner, they become owner of the task. The account that created the task also becomes supervisor of the task (and can change, suspend or assign it). All other attributes are optional.

Status is one of:

The task can be presented using a form rendered by Singleshot, or by a separate service. In the first case, use the form.html attribute to specify the form contents, input controls and other elements that will wrapped inside an HTML form. In the second case, use the form.url attribute to specify the location of a form.

The task can trigger other activities upon completion, cancellation or other lifecycle events. You can either poll to detect these changes, or register one or more Web hooks.

Templates

You can start new tasks based on a template. The template defines the basis for the task (title, description, etc), provides a form for performing the task, and can use webhooks to start other activities (e.g. kick off a workflow) when completed.

To create a new template, send a POST request to /templates with the following attributes:

For example:

{ template: {
  title:       "Request leave of absence",
  description: "Use this to schedule your vacation or report sick days ",
  potential_owners: [ "john.smith", "mary.anne", "bob.donner" ],
  form: {
    html:      "..."
  },
  webhooks: [ {
    event:     "completed",
    url:       "http://.../absencerequest/flow",
    enctype:   "application/json"
  } ]
} }

Notifications

Each account has an inbox that you can send notifications to. Notifications are delivered to the inbox tab, sent by e-mail, Web free or other mechanisms.

To create a new notification, send a POST request to /notifications with the following attributes:

Body and priority are optional, subject is required and at least one recipient.

For example:

{ notification: {
  subject: "Scheduled maintenance 4pm-6pm",
  body:     "Service will be down today (May 25th) from 4pm-6pm.",
  priority: 1,
  recipients: [ "john.smith", "mary.anne", "bob.donner" ]
} }

Notes

Links

Links let you find related resources. A link consists of the following attributes:

For example, a JSON representation of the task can include a link to the XML representation:

{ href: "http://example.com/tasks/56",
  rel:  "self",
  type: "application/xml" }

Note: you may find multiple links with the same relation but different content types.

Actions

Actions tell you how to perform various actions on related resource. An action consists of the following attributes:

For example, action to cancel the current task may read:

{ name:   "cancel",
  url:    "http://example.com/tasks/56?task[status]=cancelled",
  method: "POST" }

Note: you may find multiple actions with the same name but different content types.

Webhooks

A Webhook consists of the following attributes:

Supported encoding types are application/json (send task as JSON object), application/xml (send task as XML element) and application/x-www-form-urlencoded (send task identifier and URL using id and url parameters).

For example:

webhooks: [
  { event:    "completed",
    url:      "http://example.com/myservice/process/56/mytask",
    enctype:  "application/json" },
  { event:    "cancelled",
    url:      "http://example.com/myservice/process/56/mytask",
    enctype:  "application/json" }
]

Simple format

The task description, template description and notification body support simple formatting transformation: two newlines are interpreted as paragraph separators and URLs are automatically turned into links. Richer formatting (e.g. full use of HTML) will be explored for later releases.

Stakeholder identifiers

TBD