Ad Widget

Collapse

Unexpected response calling API method "map.update"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jros
    Junior Member
    • Mar 2023
    • 16

    #1

    Unexpected response calling API method "map.update"

    Hi all!, my first time writting here.

    I'm testing my zabbix system througth API Rest.

    I have follow the documentation, I would like to update a map.

    I have created a user role called "Api User Role" with permission to methods
    • host.get
    • hostgroup.get
    • map.get
    • map.update
    I have created a user called "api-user" and I assign "Api User Role" to it.

    I can get hosts with "host.get", get host groups with "hostgroup.get" and get maps using "map.update", I have had to give permissions on map properties->sharing to "api-user", I can retrieve a map but I can't update it, I get "No permissions to referred object or it does not exist!".

    The map exist I can get it using "map.get" and I have given permissions of Read-Write over the map. I have enabled the debug mode and API responses with:

    Code:
    {
        "jsonrpc": "2.0",
        "error": {
            "code": -32500,
            "message": "Application error.",
            "data": "No permissions to referred object or it does not exist!",
            "debug": [
                {
                    "file": "/usr/share/zabbix/include/classes/api/services/CMap.php",
                    "line": 1052,
                    "function": "exception",
                    "clas s": "CApiService",
                    "type": "::"
                },
                {
                    "file": "/usr/share/zabbix/include/classes/api/services/CMap.php",
                    "line": 1891,
                    "function": "validateUpdate",
                    "class": "CMap",
                    "type": "->"
                },
                {
                    "file": "/usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php",
                    "line": 121,
                    "function": "update ",
                    "class": "CMap",
                    "type": "->"
                },
                {
                    "file": "/usr/share/zabbix/include/classes/core/CJsonRpc.php",
                    "line": 75,
                    "function": "callMethod",
                    "c lass": "CLocalApiClient",
                    "type": "->"
                },
                {
                    "file": "/usr/share/zabbix/api_jsonrpc.php",
                    "line": 63,
                    "function": "execute",
                    "c lass": "CJsonRpc",
                    "type": "->"
                }
            ]
        },
        "id": 2
    }​
    And this is the content of the request:

    Code:
    "{
      "id": 2,
      "auth": "0b1dfd2f202e23bbf994fa5e6b3e6a23",
      "jsonrpc": "2.0",
      "method": "map.update",
      "params": {
        "sysmapid": "2",
        "width": 1200,
        "height": 1200
      }
    }"​

    Can anyone help me?

    Thanks in advance!
  • jros
    Junior Member
    • Mar 2023
    • 16

    #2
    I have to set api user as owner to able be update the map.

    Comment

    Working...