The get api for kibana spaces doesn't seem to work for python script

i need to get the spaces from my kibana and i am writing my python code for that

import requests

response = requests.get('https://<correct ELASTICSEARCH URL>:443/api/spaces/space', auth=HTTPBasicAuth('elastic', 'CORRECT PASSWORD'))
response.json()

i get this response


but according to the documentation here it should work.
so i can't understand what seems to be the issue.

Spaces are not part of the Elasticsearch API you will need to hit the Kibana API.

The Elastic Python client does not directly interact with Kibana as fair as I know, so you will need to use the Kibana API and Kibana Endpoint via an HTTP request like above but against Kibana

Right but against the Kiabana endpoint per the docs you reference, not the elasticsearch endpoint

GET <kibana host>:<port>/api/spaces/space

Thank you it worked as soon as i replaced it with kibana endpoint

1 Like

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