Skip to main content
Widgets are the core building blocks in Widgetic. Each widget is a self-contained, configurable UI component that can be embedded anywhere.

Overview

With the Widgets API, you can:
  • List the widgets your account owns, one page at a time
  • Create a widget
  • Batch fetch up to 50 widgets by ID

List Widgets

GET /widgets lists the widgets your account owns, newest first. Pass page (counting from 1) and size (1 to 100, 20 when left out) to read the list one page at a time.
meta carries the figures you need to walk the list:
A page past the end is an empty list, not an error.
Without page and size, the call returns the whole list in one response. That only suits an account with a few widgets: for a large one the response can be cut short, and nothing in it says so. If you do not know how many widgets an account holds, always page.
To read every widget, keep asking for the next page until meta.hasNextPage is false:

Widgets on One Canvas

Pass canvasId to list only the widgets on one of your canvases. That list is always returned whole, whatever page and size say.

Widgets for One Managed User

If you file widgets under your customers (see Managed Users), pass managedUserId (Widgetic’s id for the managed user) or managedUserExternalId (your own id for them) to list only that customer’s widgets. Send one of them, never both. It combines with page, size and canvasId, and it only narrows the list to your own account’s widgets.
A managed user that is not one of yours answers 404 with the code MANAGED_USER_NOT_FOUND.
The list takes no sort parameter, and no filter other than canvasId and the managed user: it is always newest first.

Create a Widget

POST /widgets creates a widget for your account: a named record with a type and some starting content, on a canvas of its own (or one of yours that you name), with a database provisioned for it. It costs no credits and has no code yet; the code is generated for it afterwards. A widget is a draft until you send isDraft: false.
The response has status 201 and carries the new widget in data (shortened here):

Fields

Only the fields above are used. Anything else in the body is ignored, with one exception: managed_user_id and managed_user_external_id are refused with 400 MANAGED_USER_REFERENCE_INVALID, so that a widget meant for a customer is never created without one. The answer carries managedUserId, and an update cannot change it. See Managed Users for the checks Widgetic makes.

Where a Widget Can Go

canvasId, projectId and organizationId must name something you may use. Naming anything else is refused with 403, and the answer is the same whether the id exists or not, so it never tells you whether an id you guessed is real. Leave canvasId out to give the widget a canvas of its own.

Warnings

If the widget’s database cannot be provisioned, the widget is still created and data.warnings is a list of what did not go through. It is absent when everything did. Read it before relying on the widget.

Retrying and Limits

  • The Idempotency-Key header is required (400 without it). Send the same value when you retry, so one widget is created, not two. See Idempotency.
  • Creating a widget provisions its database, so this call has a limit of its own: 120 per minute for each account, counted across all of that account’s keys. Past that the API answers 429 with a Retry-After header. If you need more, ask Widgetic. See Rate Limits.

Batch Fetch Widgets

POST /widgets/batch returns up to 50 widgets by ID in one request. A widget that cannot be returned comes back in errors, with the reason, while the others still come back in widgets.

Widget Structure

A widget object contains:

Widget Lifecycle

Widget Versions

Widgets keep a version history. A version is created when code is generated for the widget, and it becomes live when it is published.

Embedding Widgets

A widget is shown on a page through a composition. Create a composition on the widget, fill in its values, and put the embed code in your page:
The widget needs a published version before it can be shown. Until then the public address answers 404. See Compositions for the attributes, and SDKs for the embed script.

Next Steps

Compositions

Set a widget up for one place and embed it

Canvases

Edit widgets on canvases