How to get and post kibana spaces by api call?

Hello everyone, I would like to know how I can return kibana spaces via api, I tried from the documentation: Kibana spaces APIs | Kibana Guide [8.3] | Elastic, but when I give a get , I don't get the default spaces and stuff I created. When I enter dev tools and use the POST command :/api/spaces/space kibana just creates this space with an index api, but this space is also not shown via get. I would like to know some method to return the default spaces of kibana through dev tools. I would like to know how to create and query the spaces that are shown in the kibana graphical interface when I access the path "/management/kibana/spaces".

Hi Gabriel,
Sorry you didn't get any response sooner. Maybe you already solved it?

The Kibana Dev Tools console only connects to Elasticsearch and the Spaces API is a Kibana API so you can't use the Dev Tools for it. In the example below, I had first created a space named "testSpace" in Kibana. Then I use curl to get the spaces. I have security enabled and included my username:password in the URL, but you can also use -u argument to curl.
I piped it through jq just for formatting but that's optional. This should get you on your way to creating spaces as well. Post again if you get stuck.

Regards,
Lee

main/kibana - (main) > curl -XGET https://elastic:changeit@localhost:5601/api/spaces/space | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   243  100   243    0     0   8002      0 --:--:-- --:--:-- --:--:-- 11571
[
  {
    "id": "default",
    "_reserved": true,
    "color": "#00bfb3",
    "description": "This is your default space!",
    "disabledFeatures": [],
    "name": "Default"
  },
  {
    "id": "testspace",
    "name": "testSpace",
    "initials": "t",
    "color": "#B9A888",
    "disabledFeatures": [],
    "imageUrl": ""
  }
]

Update: In 8.3 release of Kibana you actually CAN use the Dev Tools console! You just add the kbn:

GET kbn:/api/spaces/space

[
  {
    "id": "default",
    "_reserved": true,
    "color": "#00bfb3",
    "description": "This is your default space!",
    "disabledFeatures": [],
    "name": "Default"
  },
  {
    "id": "testspace",
    "name": "testSpace",
    "initials": "t",
    "color": "#B9A888",
    "disabledFeatures": [],
    "imageUrl": ""
  }
]

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