Get Block by ID landing.block.getbyid

We are still updating this page

Some data may be missing — we will complete it shortly.

Scope: landing

Who can execute the method: any user

The method landing.block.getbyid retrieves a block by its identifier. It returns the block or an error.

Parameters

Method

Description

Available since

block
unknown

Block identifier

params
unknown

Parameters: edit_mode - Editing mode (1) or not (0 - default), will return a different set of blocks.

Examples

try
        {
        	const response = await $b24.callMethod(
        		'landing.block.getbyid',
        		{
        			block: 6102,
        			params: {
        				edit_mode: 0
        			}
        		}
        	);
        	
        	const result = response.getData().result;
        	console.info(result);
        }
        catch( error )
        {
        	console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'landing.block.getbyid',
                    [
                        'block' => 6102,
                        'params' => [
                            'edit_mode' => 0
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your required data processing logic
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error getting block by ID: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'landing.block.getbyid',
            {
                block: 6102,
                params: {
                    edit_mode: 0
                }
            },
            function(result)
            {
                if(result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.info(result.data());
                }
            }
        );
        

How to Use Examples in Documentation