Áú»¢¶Ä²©

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

template.update

Opis

object template.update(object/array templates)

Ta metoda umo?liwia aktualizacj? istniej?cych szablon¨®w.

Ta metoda jest dost?pna tylko dla u?ytkownik¨®w typu Admin i Super admin.Uprawnienia do wywo?ania tej metody mog? zosta? odebrane w ustawieniach roli u?ytkownika.Zobacz Role u?ytkownik¨®w aby uzyska? wi?cej informacji.

Parametry

(object/array) W?a?ciwo?ci szablon¨®w do zaktualizowania.

W?a?ciwo?? templateid musi by? zdefiniowana dla ka?dego szablonu, wszystkie inne w?a?ciwo?ci s? opcjonalne. Tylko podane w?a?ciwo?ci zostan? zaktualizowane, pozosta?e pozostan? niezmienione.

°¿±è°ù¨®³¦³ú standardowych w?a?ciwo?ci szablonu, metoda akceptuje nast?puj?ce parametry.

Parametr Typ Opis
groups object/array Grupy host¨®w, kt¨®re maj? zast?pi? bie??ce grupy host¨®w, do kt¨®rych nale?? szablony.

Grupy host¨®w musz? mie? zdefiniowan? w?a?ciwo?? groupid.
tags object/array Znaczniki szablonu, kt¨®re maj? zast?pi? bie??ce znaczniki szablonu.
macros object/array Makra u?ytkownika, kt¨®re maj? zast?pi? bie??ce makra u?ytkownika w podanych szablonach.
templates object/array Szablony, kt¨®re maj? zast?pi? aktualnie po??czone szablony. Szablony, kt¨®re nie s? przekazywane, s? tylko od??czane.

Szablony musz? mie? zdefiniowan? w?a?ciwo?? templateid.
templates_clear object/array Szablony, kt¨®re maj? zosta? od??czone i wyczyszczone z podanych szablon¨®w.

Szablony musz? mie? zdefiniowan? w?a?ciwo?? templateid.

Zwracane warto?ci

(object) Zwraca obiekt zawieraj?cy identyfikatory zaktualizowanych szablon¨®w we w?a?ciwo?ci templateids.

Przyk?ady

Changing the standard template properties

Change the technical name of the template to "Linux by Áú»¢¶Ä²© agent Custom", the visible name to "My template", and update the template description.

Request:

{
           "jsonrpc": "2.0",
           "method": "template.update",
           "params": {
               "templateid": "10086",
               "host": "Linux by Áú»¢¶Ä²© agent Custom",
               "name": "My template",
               "description": "This is a custom Linux template."
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10086"
               ]
           },
           "id": 1
       }

Updating template groups

Replace all template groups for the given template with a different one.

Request:

{
           "jsonrpc": "2.0",
           "method": "template.update",
           "params": {
               "templateid": "10086",
               "groups": [
                   {
                       "groupid": "24"
                   } 
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10086"
               ]
           },
           "id": 1
       }

Updating template tags

Replace all template tags with a different one.

Request:

{
           "jsonrpc": "2.0",
           "method": "template.update",
           "params": {
               "templateid": "10086",
               "tags": [
                   {
                       "tag": "Host name",
                       "value": "{HOST.NAME}"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10086"
               ]
           },
           "id": 1
       }

Updating template macros

Replace all template macros with a different one.

Request:

{
           "jsonrpc": "2.0",
           "method": "template.update",
           "params": {
               "templateid": "10086",
               "macros": [
                   {
                       "macro": "{$MY_MACRO}",
                       "value": "new_value"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10086"
               ]
           },
           "id": 1
       }

Updating template linked templates

Unlink (without clearing) all templates from the given template and link a different one to it.

Request:

{
           "jsonrpc": "2.0",
           "method": "template.update",
           "params": {
               "templateid": "10086",
               "templates": [
                   {
                       "templateid": "10087"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10086"
               ]
           },
           "id": 1
       }

Clearing template linked templates

Unlink and clear the given template from a specific linked template.

Request:

{
           "jsonrpc": "2.0",
           "method": "template.update",
           "params": {
               "templateid": "10086",
               "templates_clear": [
                   {
                       "templateid": "10087"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10086"
               ]
           },
           "id": 1
       }

?°ù¨®»å?´Ç

CTemplate::update() w ui/include/classes/api/services/CTemplate.php.