Theme API

Write Call

ReplaceShopMedia1

Replace one image or video of a shop with an uploaded file, or remove it. Affects the shop's customer-facing pages at once.

Kind Write API call
Method POST
URL https://app.bubblehouse.com/api/v2023061/<shop>/ReplaceShopMedia1
Authentication Shop TokenStaff Token
This endpoint accepts multipart/form-data requests. Send the file in the 'file' field and JSON parameters in the 'data' field.

Needs the media edit permission or theme edit. Get the key and revision from ListShopMedia1 first; any image or video it lists with filter all can be set.

Through MCP, call create_file_upload, POST the file to upload_url, then pass file: {preuploaded_file_id}. Over HTTP, send one multipart file part named file. Images and videos in Bubblehouse formats are accepted, at most 30 MiB; entity images take images only, and wallet pass images PNG only. remove clears the image instead, without a file.

A theme change is checked like other theme writes: if it adds configuration errors, nothing is saved. dry_run checks the file and the change without storing or saving anything. The file is stored before the configuration is saved; if the configuration changed meanwhile, nothing is saved, so read again and upload again.

Input

  • key string required

    The key from ListShopMedia1.

  • remove boolean optional

    Remove the image or video instead of replacing it; pass no file.

  • expected_revision string required

    revision from the latest list call. If the configuration was saved since, the call fails without saving; read again.

  • dry_run boolean optional

    Check the change and report what it would do, without saving.

  • allow_new_errors boolean optional

    Save even when the change adds configuration errors. They are still returned in new_errors.

Output

  • saved boolean required

    Whether anything was saved. False for a dry run and when no value differed from what was saved.

  • revision string required

    The configuration's revision after the call.

  • changes array of ThemeSettingChange1 required

    What changed, in key order.

  • new_errors array required

    Configuration errors the change adds. Empty for a saved change unless allow_new_errors was set.

  • fixed_errors array required

    Configuration errors the change removes.

  • warnings array required

    Things that were accepted but look off, such as an enum value outside its options.

Usage Examples

A new tier hero image

Request

{
  "expected_revision": "1086983a00000003:2:7:3",
  "file": {
    "preuploaded_file_id": "1086983a00000999"
  },
  "key": "tier.1086983a00000123.hero.image"
}

Response

{
  "changes": [
    {
      "key": "tier.1086983a00000123.hero.image",
      "new": "s1086983a00000003-f1086983a00000999-p3r8t2v6y9.png",
      "old": "s1086983a00000003-f1086983a00000789-k2m9q4w7x1.png"
    }
  ],
  "fixed_errors": [],
  "new_errors": [],
  "revision": "1086983a00000003:2:8:3",
  "saved": true,
  "warnings": []
}

Specific Errors

Status Error Reason & Examples
400 bad_data

The key is not an image or video of this shop, the configuration changed since it was read, or the change would add configuration errors. Nothing was saved.

For example: tier.1086983a00000123.hero.png is not an image or video of this shop; ListShopMedia1 with filter all lists them

422 invalid_uploaded_file

The file is missing, of the wrong type or too large, or the temporary upload is unknown, used or expired.

403 access_denied

Your permissions do not allow this call.

Global Errors

Status Error Reason & Examples
401 invalid_token

The provided authentication token is invalid or has expired.

For example: The token has expired

Previous
ListThemeBlocks1