Theme API
Write CallUpdateShopStyles1
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
-
valuesobject requiredKeys mapped to new values, strings for every styling type;
nullremoves a saved value. At most 500 keys. -
expected_revisionstring requiredrevisionfrom the latest list call. If the configuration was saved since, the call fails without saving; read again. -
dry_runboolean optionalCheck the change and report what it would do, without saving.
-
allow_new_errorsboolean optionalSave even when the change adds configuration errors. They are still returned in
new_errors.
Output
-
savedboolean requiredWhether anything was saved. False for a dry run and when no value differed from what was saved.
-
revisionstring requiredThe configuration's revision after the call.
-
What changed, in key order.
-
new_errorsarray requiredConfiguration errors the change adds. Empty for a saved change unless
allow_new_errorswas set. -
fixed_errorsarray requiredConfiguration errors the change removes.
-
warningsarray requiredThings 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: For example: |
| 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: |