[comment]: # translation:outdated

[comment]: # ({0067e4a0-0067e4a0})
# map.create

[comment]: # ({/0067e4a0-0067e4a0})

[comment]: # ({0fca4fb7-279559e4})
### Apraksts

`object map.create(object/array maps)`

Šī metode ļauj izveidot jaunas kartes.

::: noteclassic
Šī metode ir pieejama jebkura tipa lietotājiem. Atļaujas
izsaukt šo metodi var tikt atsauktas lietotāja lomas iestatījumos. Plašāku informāciju skatiet sadaļā [Lietotāju
lomas](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/0fca4fb7-279559e4})

[comment]: # ({33cc3b82-73d879ea})
### Parametri

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

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

|Parametrs|[Tips](/manual/api/reference_commentary#data-types)|Apraksts|
|--|--|------|
|links|array|[Kartes saites](/manual/api/reference/map/object#map-link), kas jāizveido kartē.|
|selements|array|[Kartes elementi](/manual/api/reference/map/object#map-element), kas jāizveido kartē.|
|urls|array|[Kartes URL](/manual/api/reference/map/object#map-url), kas jāizveido kartē.|
|users|array|[Kartes lietotāju](/manual/api/reference/map/object#map-user) koplietošanas ieraksti, kas jāizveido kartē.|
|userGroups|array|[Kartes lietotāju grupu](/manual/api/reference/map/object#map-user-group) koplietošanas ieraksti, kas jāizveido kartē.|
|shapes|array|[Kartes formas](/manual/api/reference/map/object#map-shapes), kas jāizveido kartē.|
|lines|array|[Kartes līnijas](/manual/api/reference/map/object#map-lines), kas jāizveido kartē.|

::: notetip
Lai izveidotu kartes saites, jums būs jāiestata kartes elementa
`selementid` uz patvaļīgu vērtību un pēc tam jāizmanto šī vērtība, lai atsauktos uz
šo elementu saišu īpašībās `selementid1` vai `selementid2`.
Kad elements tiks izveidots, šī vērtība tiks aizstāta ar
pareizo ID, ko ģenerējis Zabbix. [Skatīt
piemēru.](create#create-a-host-map)
:::

[comment]: # ({/33cc3b82-73d879ea})

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

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

[comment]: # ({/2e617567-2e617567})

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

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

[comment]: # ({0b0f72b1-584ef8f6})
#### Izveidot tukšu karti

Izveidojiet karti bez elementiem.

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

```json
{
    "jsonrpc": "2.0",
    "method": "map.create",
    "params": {
        "name": "Map",
        "width": 600,
        "height": 600
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "8"
        ]
    },
    "id": 1
}
```

[comment]: # ({/0b0f72b1-584ef8f6})

[comment]: # ({80c143be-e32540ab})
#### Izveidot hostu karti

Izveidojiet karti ar diviem hosta elementiem un saiti starp tiem. Ņemiet vērā
pagaidu "selementid1" un "selementid2" vērtību izmantošanu kartes saites
objektā, lai atsauktos uz kartes elementiem.

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

```json
{
    "jsonrpc": "2.0",
    "method": "map.create",
    "params": {
        "name": "Host map",
        "width": 600,
        "height": 600,
        "selements": [
            {
                "selementid": "1",
                "elements": [
                    {"hostid": "1033"}
                ],
                "elementtype": 0,
                "iconid_off": "2"
            },

            {
                "selementid": "2",
                "elements": [
                    {"hostid": "1037"}
                ],
                "elementtype": 0,
                "iconid_off": "2"
            }
        ],
        "links": [
            {
                "selementid1": "1",
                "selementid2": "2"
            }
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "9"
        ]
    },
    "id": 1
}
```

[comment]: # ({/80c143be-e32540ab})

[comment]: # ({3ba12e07-9a8ffa0d})
#### Izveidot trigeru karti

Izveidojiet karti ar trigeru elementu, kurā ir divi trigeri.

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

```json
{
    "jsonrpc": "2.0",
    "method": "map.create",
    "params": {
        "name": "Trigger map",
        "width": 600,
        "height": 600,
        "selements": [
            {
                "elements": [
                    {"triggerid": "12345"},
                    {"triggerid": "67890"}
                ],
                "elementtype": 2,
                "iconid_off": "2"
            }
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "10"
        ]
    },
    "id": 1
}
```

[comment]: # ({/3ba12e07-9a8ffa0d})

[comment]: # ({02133606-d8024143})
#### Kartes kopīgošana

Izveidojiet karti ar diviem kopīgošanas veidiem (lietotājs un lietotāju grupa).

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

```json
{
    "jsonrpc": "2.0",
    "method": "map.create",
    "params": {
        "name": "Map sharing",
        "width": 600,
        "height": 600,
        "users": [
            {
                "userid": "4",
                "permission": "3"
            }
        ],
        "userGroups": [
            {
                "usrgrpid": "7",
                "permission": "2"
            }
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "9"
        ]
    },
    "id": 1
}
```

[comment]: # ({/02133606-d8024143})

[comment]: # ({5865612b-2fa44a8b})
#### Kartes formas

Izveidojiet karti ar kartes nosaukumu virsrakstā.

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

```json
{
    "jsonrpc": "2.0",
    "method": "map.create",
    "params": {
        "name": "Host map",
        "width": 600,
        "height": 600,
        "shapes": [
            {
                "type": 0,
                "x": 0,
                "y": 0,
                "width": 600,
                "height": 11,
                "text": "{MAP.NAME}"
            }
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "10"
        ]
    },
    "id": 1
}
```

[comment]: # ({/5865612b-2fa44a8b})

[comment]: # ({0fa9ab90-5aa58242})
#### Kartes līnijas

Izveidojiet kartes līniju.

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

```json
{
    "jsonrpc": "2.0",
    "method": "map.create",
    "params": {
        "name": "Map API lines",
        "width": 500,
        "height": 500,
        "lines": [
            {
                "x1": 30,
                "y1": 10,
                "x2": 100,
                "y2": 50,
                "line_type": 1,
                "line_width": 10,
                "line_color": "009900"
            }
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "11"
        ]
    },
    "id": 1
}
```

[comment]: # ({/0fa9ab90-5aa58242})

[comment]: # ({225974d1-436079d5})
### Skatiet arī

-   [Kartes elements](object#map-element)
-   [Kartes saite](object#map-link)
-   [Kartes URL](object#map-url)
-   [Kartes lietotājs](object#map-user)
-   [Kartes lietotāju grupa](object#map-user-group)
-   [Kartes forma](object#map-shapes)
-   [Kartes līnija](object#map-lines)

[comment]: # ({/225974d1-436079d5})

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

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

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