Update a Block

Updating Existing Blocks

PUT /api/blocks/{block_id}/

To update an existing block, send a PUT request to the endpoint with the block ID in the URL.

Request Example

PUT /api/blocks/42

Include the block details in the HTTP request body according to the specified Content-Type. The type field is required.

Request Parameters

Parameter Type Required Description
type string Yes Type of the block (e.g., "template", "html", "menu")
name string No Name of the block
properties object No Block-specific properties
lang_code string No Language code for multilingual stores

Example JSON Payload

{
  "type": "template",
  "name": "Example Template 2",
  "properties": {
    "template": "blocks/static_templates/my_account_links.tpl"
  }
}

This request changes the block type to "Template", and updates both the name and template path of the block.

Multilingual Support: For stores with multiple languages, you can update the block name for a specific language by including the lang_code parameter. For example, adding "lang_code": "ru" to your JSON will only change the name for the Russian language.

Response

{
  "block_id": "42"
}

Response Status Codes

Status Code Description
200 OK Block was updated successfully
400 Bad Request Invalid request parameters
404 Not Found Block with the specified ID does not exist