POST method to create role and grant privilege in spaces

Hi,
I am trying to figure out how to user DevTools to create role and grant privilege to spaces. I tried with below codes but it says failed to parse role [QA]. unexpected field [spaces]. May i know where can i find the document to create role and grant spaces privileges using POST ?

POST _security/role/QA
{
"indices": [
{
"names": ["moha","amlorders"],
"privileges": [ "all" ]
}
],
"spaces": [{
"Risk Profiling Space (RPS)" : ["all"]
}
]
}

In case someone needed, the following is the answer:

POST _security/role/QA
{
"indices": [
{
"names": [ "moha","amlorders" ],
"privileges": [ "all" ]
}
],
"applications": [
{
"application": "kibana-.kibana",
"privileges" : [
"feature_dashboard.all",
"feature_visualize.all",
"feature_discover.all"
],
"resources" : ["*"]
}
]
}

Hi @nameisnotimportant,

Glad you have found an answer, but be aware that DevTools work with Elasticsearch directly and Spaces is a Kibana-only concept, so the request you have may not work as you expect in the future versions or even in this version. That's why you should use Kibana APIs to create Spaces-aware roles instead (e.g. with cURL, since DevTools cannot work with Kibana API endpoints).

Best,
Oleg