This is a translation of the original English documentation page. Help us make it better.

Objecte de macros d'usuaris

Els següents objectes són relacionats amb l'API usermacro.

Macro global

L'objecte té les propietats següents.

Propietat Tipus Descripció
globalmacroid ID ID de macro global.

Comportament de la propietat:
- només lectura
- obligatori per operacions d'actualització
macro cadena Cadena de macro.

Comportament de la propietat:
- obligatori per operacions de creació
value cadena Valor de la macro.

Comportament de la propietat:
- només lectura
- només escriptura si type és "Macro secreta"
- obligatori per operacions de creació
type enter Tipus de la macro.

Valors possibles:
0 - (per defecte) Text de la macro;
1 - Macro secreta;
2 - Secret de caixa de cabals.
description cadena Descripció de la macro.

Macro d'equip

L'objecte defineix una macro disponible a un equip, prototip d'equip o plantilla. Té les propietats següents.

Propietat Tipus Descripció
hostmacroid ID ID de la macro d'equip.

Comportament de la propietat:
- només lectura
- obligatori per operacions d'actualització
hostid string ID de l'equip a qui pertany la macro.

Comportament de la propietat:
- constant
- obligatori per operacions de creació
macro string Cadena de la macro.

Comportament de la propietat:
- obligatori per operacions de creació
value string Valor de la macro.

Comportament de la propietat:
- només escriptura si type és "Macro secreta"
- obligatori per operacions de creació
type integer Tipus de la macro.

Valors possibles:
0 - (per defecte) Text de la macro;
1 - Macro secreta;
2 - Secret de caixa de cabals.
description string Descripció de la macro.
automàtic integer Defineix si la macro és controlada per la regla de descoberta.

Valors possibles:
0 - (per defecte) La macro la gestiona l'usuari;
1 - La macro la gestiona la regla de descoberta.

L'usuari no pot crear una macro automàtica.
Per actualitzar la macro automàtica, s'ha de convertir a manual.

Macro configuration

The macro configuration object defines how a macro is displayed in the Host Wizard.

Property Type Description
type integer Type of macro input field.

Possible values:
0 - Macro is not used in Host Wizard;
1 - Textbox;
2 - List;
3 - Checkbox.

Property behavior:
- required
label string Label for macro input field.

Property behavior:
- required if type is set to "Textbox", "List", or "Checkbox"
description text Help text displayed alongside macro input field. Supports Markdown formatting.
priority integer Macro input field position in the macro list.

If priority is not set, the macro is added at the end of the ungrouped macro list.
required integer Marks the macro as mandatory.

Possible values:
0 - Not mandatory;
1 - Mandatory.

Property behavior:
- supported if type is set to "Textbox" or "List"
regex string Regular expression to validate user input in a textbox field.

Property behavior:
- supported if type is set to "Textbox"
section_name string Label of the collapsible section where the macro is grouped.

If section_name is not set, the macro is ungrouped. Ungrouped macros are displayed first; grouped macros are displayed below, ordered by their priority within each collapsible section.
options text JSON string defining list items or checkbox values.

For lists: an array of objects with value and text properties.
Example: [{"value": "http", "text": "HTTP"}, {"value": "https", "text": "HTTPS"}]

For checkboxes: an object with checked and unchecked properties.
Example: {"checked": true, "unchecked": false}

Property behavior:
- required if type is set to "List" or "Checkbox"