Ana içeriğe geç

searchBlock

Quick search for block objects with limited output. It returns a Promise that resolves to an array of ISearchBlock objects.

Description

This method performs a quick search for block objects by name with limited output (lightweight result set, suitable for autocomplete). It returns a Promise that resolves to an array of ISearchBlock objects.

Blocks.searchBlock(

name*, langCode

);

Parameters schema

Schema

name(required): string
Search string
example: "product_block"

langCode: string
Language code. Default: "en_US"
example: "en_US"

Examples

Minimal example

const response = await Blocks.searchBlock('my-marker');

Example with attributes

const response = await Blocks.searchBlock('my-marker', 'en_US');

Example response

[
{
"id": 12,
"identifier": "repeat",
"name": "Repeat"
},
{
"id": 10,
"identifier": "personal",
"name": "Personal"
},
{
"id": 9,
"identifier": "similar_wishlist",
"name": "Similar wishlist"
},
"..."
]

Response schema

Schema: ISearchBlock[]

id: number
Unique identifier of the search block.
example: 1

identifier: string
Unique string identifier for the search block.
example: "search_block_1"

name: string
Name of the search block.
example: "Search Block 1"