Creating rules in different spaces through API

When creating a rule in kibana it shows in the developer tools that the end point of the specific space is used to create the rule within the space.

Request URL: {kibana_url}/s/{space_name}/api/alerting/rule

But when we use this same end point to create a rule using curl, it does not recognize the endpoint. Is there a way that we could create a rule within a specific space using the api and not the UI?

Hi @Joey_Visbeen,

It's not something I've done myself, but looking at the spaces documentation and the create rule endpoint it looks possible. Which version of Kibana are you communicating with?

Can you share the full cURL request and the full error you are receiving? Can you also confirm if you are able to create a rule in the default space (i.e. without the /s/space_name} option)?

A reply! Thank you :grinning:

I have fixed it, it turned out I was using the wrong URL. The output in the console hides the host and only shows the path. I was using the ES host instead of the Kibana.

So to answer my own question, yes it is possible, just make sure the URL is correct. Use the kibana host and the right path.

1 Like