Theme API

Write Call

UpdateShopStyles1

Change a shop's theme styling, such as colors, sizes and style classes, with checks: unknown keys, keys that are not styling and wrong value types are refused, and so is a change that adds configuration errors. Affects the shop's customer-facing pages at once.

Kind Write API call
Method POST
URL https://app.bubblehouse.com/api/v2023061/<shop>/UpdateShopStyles1
Authentication Shop TokenStaff Token

Needs the styling edit permission (or theme edit); CSS also needs the custom code permission. Get keys and revision from ListShopStyles1 first.

values maps keys to new values; null removes what is saved, so the default applies again. Keys you do not mention stay as they are. Any styling setting of the theme can be set, also one not listed as configured.

Before saving, the shop's configuration is built with the change in. If that adds configuration errors, nothing is saved and they are returned. dry_run runs the checks without saving; allow_new_errors saves anyway. Saves are recorded in the shop's settings history under your user.

Input

  • values object required

    Keys mapped to new values, strings for every styling type; null removes a saved value. At most 500 keys.

  • 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

Change a color

Request

{
  "expected_revision": "1086983a00000003:2:7:3",
  "values": {
    "banner.background.color": "#0b3d91"
  }
}

Response

{
  "changes": [
    {
      "key": "banner.background.color",
      "new": "#0b3d91",
      "old": "#ffffff"
    }
  ],
  "fixed_errors": [],
  "new_errors": [],
  "revision": "1086983a00000003:2:8:3",
  "saved": true,
  "warnings": []
}

Specific Errors

Status Error Reason & Examples
400 bad_data

A key or value was refused, the configuration changed since it was read, or the change would add configuration errors. Nothing was saved.

For example: banner.title.string is not a styling setting; ListShopStyles1 lists them. Nothing was saved

For example: the shop's configuration changed since you read it; call ListShopStyles1 again and use its revision

403 access_denied

Your permissions do not allow this call, or the key holds custom code (CSS) and your permissions do not allow editing it.

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
UpdateShopStrings1