Strapi

Manage entries, single types, media, users, and roles in Strapi.

v1.0.0Source

Install

Manage Strapi entries, single types, media, users, roles, and authentication, and start a workflow on a Strapi webhook event. Use it to read and write the content of a headless CMS.

Strapi@zerodot/strapiInstall
  1. Open System, then Nodes.
  2. Find Strapi and click Install.
  3. Use the new nodes at once. You do not restart.

How it works

Strapi (strapi.api) is an action node in the Strapi package (@zerodot/strapi): Manage entries, single types, media, users, and roles in Strapi.

The node uses the REST API of Strapi 5 (default) and Strapi 4. Set the version in the credential. Strapi 5 uses the documentId and flat fields. Strapi 4 uses the numeric id, and the fields are in attributes. For Strapi 4, Simplify moves the fields of attributes to the top of each entry.

  • Entry: create, get, get many, update, delete. Set the Content Type to the plural API ID (for example articles).
  • Single Type: get, update, delete. Set the singular API ID (for example homepage).
  • Media: get many, get, update (file info), delete, upload (from binary data or from a URL, with an optional link to an entry field)
  • User (Users & Permissions): create, get, get many, update, delete, get the current user, count
  • Role: get many, get
  • Authentication: log in, register, forgot password, reset password, change password, send email confirmation

Entry and Single Type operations have these options:

  • Data (JSON): a JSON object with the fields. The node sends it as {"data": …}.
  • Populate: *, relation names with commas between, or a JSON object for a deep populate.
  • Fields, Locale, and Status (published or draft). Strapi 4 does not have status. For a read, the node sends publicationState (live or preview). For a write, the node sends nothing: in Strapi 4 an entry stays a draft unless the data has publishedAt.
  • Filters (JSON) and Filters (Key And Value). A key without an operator means $eq. Use title[$contains] for other operators.
  • Sort (for example title:desc) and Pagination: Page (page and pageSize) or Start And Limit.

Lists have Return All (at most 5000 items) and Limit. Users and files ignore pagination[...] in Strapi, so the node sends the top-level start and limit for them. For entries, with Page, the node follows meta.pagination.pageCount. With Start And Limit, the node reads until a page is short. The Role list has no paging in Strapi, so the node cuts the list at the limit.

Notes:

  • Publish and unpublish have no separate route in the Strapi REST API. Use Status (Strapi 5): without a status, Create and Update publish the entry. With draft, they save a draft.
  • Delete cannot be undone. Strapi 5 gives no body for a delete, so the node gives { "success": true }.
  • Get Current User and Change Password need the JWT of a user. An API token cannot do this. With a Strapi user login credential, the node uses its login. With an API token, set User JWT (for example from Log In).
  • Log In, Register, Forgot Password, Reset Password, and Send Email Confirmation send no token. Strapi limits these routes (10 requests each minute by default).
  • Media upload sends multipart/form-data. Link a file to an entry with Link To Entry: the model UID (api::article.article), the numeric entry ID, and the media field. The file ID of Get, Update, and Delete is also numeric: the upload routes do not take a documentId. A file from a URL can be at most 50 MB. The node reads the body as a stream and stops at the limit. It follows at most 5 redirects, and checks each address. It refuses a host that is or resolves to a private, local, link-local, or metadata address (for example 127.0.0.1, 10.0.0.0/8, 169.254.169.254, or ::1).

When Strapi gives an error, the node fails with the message, the details, the error name, and a short help text. A rate limit (HTTP 429) gives the time to wait.

Logins it can use

Strapi API token (strapi.apiToken): url (the address of the server, without /api), apiToken from Settings > API Tokens, and version (Strapi 5 or Strapi 4). The Test button reads the user count. A token that cannot read users also passes: Strapi answers 403 for a good token and 401 for a bad one.

Strapi user login (strapi.password): url, identifier (email or user name), password, and version. The node logs in with POST /api/auth/local one time in each run and uses the JWT. The Test button logs in and reads the current user. Use a user of the Users & Permissions plugin. The permissions of its role limit what the node can do.

Both credentials have the optional webhookHeader and webhookSecret for the trigger. The token, the password, and the webhook value are secret.

Guides and related hubs