Creating a kibana role using Dev Tools

Hi,
I am using ElasticCloud v7.9.0, I use Dev Tools to do the setup on kibana like creating users, indexes,... I want to create a kibana role as well however I get an error:

    PUT /_security/role/mytestrole
    { 
        "elasticsearch": {
            "indices": [{
                "names": [ "mytestindex*" ],
                "privileges": ["create", "write", "create_index"]
            }]
        },
        "kibana": [{
            "base": [],
            "feature": {"visualize": ["all"],"dashboard": ["read", "url_create"], "metrics": ["all"], "logs": ["all"]},
            "spaces": ["myspace"]
        }] 
    }

Error is:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "parse_exception",
        "reason" : "failed to parse role [mytestrole]. unexpected field [elasticsearch]"
      }
    ],
    "type" : "parse_exception",
    "reason" : "failed to parse role [mytestrole]. unexpected field [elasticsearch]"
  },
  "status" : 400
}

I was able to create the role using Postman however not true Dev Tools.
I followed the steps on the following link:
https://www.elastic.co/guide/en/kibana/current/role-management-api-put.html

Is there anyway to run this using Dev tools?

Hi, the API URL is a bit different from the one you have used:

PUT <kibana host>:<port>/api/security/role/my_kibana_role

so in your case you should use:

PUT /api/security/role/mytestrole

If I use /api/ I'll get this error:

{
  "error" : "no handler found for uri [/api/security/role/mytestrole?pretty=true] and method [PUT]"
}

I'm sorry I've just read partially your request. No is not possible to access Kibana API directly from devTools, it's used only as ES proxy and doesn't handle API requests like that one

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.