PERS icon

PERS

Interact with the PERS Loyalty API

Actions14

Files → Upload File

AI-generated

Summary

Uploads a binary file from the incoming item to PERS entity storage (S3) in one step: it requests a PUT signed URL from the PERS API, then PUTs the file bytes to that URL.

Inputs

  • Entity Type (required) — Entity the file belongs to: business, campaign, redemption, tenant, token or user. Default is business.
  • Entity ID (required) — Unique ID of the entity (e.g. the business ID) that the file is stored under.
  • Binary Property (required) — Name of the binary property on the input item that holds the file. Default is "data". The node errors if the item has no binary data under this name.
  • File Extension — Extension such as png or jpg. If empty, it uses the binary data's file extension. Failing that, it maps the MIME type (png, jpg, gif, webp, svg, pdf), and otherwise falls back to "bin".
  • File Name — Optional file name sent to the PERS API when requesting the signed URL. If empty, it is omitted from the request, so the API auto-generates it.

Output shape

One output item per input item, with a json object containing success (true), entityType, entityId, fileExtension, fileName, mimeType, url and signedUrl.

url is the signed URL with its query string removed, so it is the object's storage URL. It is not guaranteed to be publicly readable. signedUrl is the full upload URL, which is likely time-limited. fileName reports the binary's file name first, then the File Name parameter, then "uploaded_file", and may not match the name the API actually stored. The MIME type defaults to application/octet-stream if the binary has none. It throws an error if the API returns no signed URL (it accepts signedUrl or url in the response). With Continue On Fail enabled, failed items return json.error instead. It uses the persApi credential's environment as the base URL.

Examples

Example 1: Upload a logo image downloaded by an HTTP Request node to a business.

Entity Type: Business; Entity ID: the business UUID; Binary Property: data; File Extension and File Name left empty.

Example 2: Upload a generated PDF as a token asset with a specific name.

Entity Type: Token; Entity ID: the token ID; Binary Property: data; File Extension: pdf; File Name: terms.

Links

Discussion