[comment]: # translation:outdated

[comment]: # ({7f5b147d-7f5b147d})
# veidne.create

[comment]: # ({/7f5b147d-7f5b147d})

[comment]: # ({82525ddb-d9142f8c})
### Apraksts

`object template.create(object/array templates)`

Šī metode ļauj izveidot jaunas veidnes.

::: noteclassic
Šī metode ir pieejama tikai *Admin* un *Super admin*
lietotāju tipiem. Atļaujas izsaukt šo metodi var tikt atsauktas lietotāja lomas
iestatījumos. Plašāku informāciju skatiet [Lietotāju
lomas](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/82525ddb-d9142f8c})

[comment]: # ({0309410d-95e9c6ad})
### Parametri

`(object/array)` Veidnes, ko izveidot.

Papildus [standarta veidnes īpašībām](object#template)
metode pieņem šādus parametrus.

|Parametrs|[Tips](/manual/api/reference_commentary#data-types)|Apraksts|
|--|--|------|
|groups|object/array|[Veidņu grupas](/manual/api/reference/templategroup/object), kurām pievienot veidni.<br><br>Veidņu grupām jābūt definētai tikai īpašībai `groupid`.<br><br>[Parametra darbība](/manual/api/reference_commentary#parameter-behavior):<br>- *obligāts*|
|tags|object/array|[Veidņu birkas](/manual/api/reference/template/object#template-tag).|
|templates|object/array|[Veidnes](/manual/api/reference/template/object), kas jāpiesaista veidnei.<br><br>Veidnēm jābūt definētai tikai īpašībai `templateid`.|
|macros|object/array|[Lietotāja makrosi](/manual/api/reference/usermacro/object), kas jāizveido veidnei.|

[comment]: # ({/0309410d-95e9c6ad})

[comment]: # ({68ed5aa8-68ed5aa8})
### Atgrieztās vērtības

`(object)` Atgriež objektu, kas satur izveidoto veidņu ID
īpašībā `templateids`. Atgriezto ID secība atbilst
nodoto veidņu secībai.

[comment]: # ({/68ed5aa8-68ed5aa8})

[comment]: # ({b41637d2-b41637d2})
### Piemēri

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({47ddcd78-104d61d1})
#### Veidnes izveide

Izveidojiet veidni ar tagiem un piesaistiet šai veidnei divas veidnes.

[Pieprasījums](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "template.create",
    "params": {
        "host": "Linux template",
        "groups": {
            "groupid": 1
        },
        "templates": [
            {
                "templateid": "11115"
            },
            {
                "templateid": "11116"
            }
        ],
        "tags": [
            {
                "tag": "host-name",
                "value": "{HOST.NAME}"
            }
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "11117"
        ]
    },
    "id": 1
}
```

[comment]: # ({/47ddcd78-104d61d1})

[comment]: # ({15290398-15290398})
### Avots

CTemplate::create() failā *ui/include/classes/api/services/CTemplate.php*.

[comment]: # ({/15290398-15290398})
