API to create new dashboard in Kibana 8.9.0

POST <kibana host>:<port>/api/kibana/dashboards/import
POST <kibana host>:<port>/s/<space-id>/api/kibana/dashboards/import
The above apis are deprecated. Could you please help with alternate APIs to create new dashboard?
I want to follow below approach to automate creating and updating dashboard?

  1. Check if kibana space exist or else create new one.
  2. Check if dashboard exists else create empty dashboard.
  3. the get the dashbaord ID
  4. Replace the dashboard id in ndjson file(As I observed dashboard id is mandatory to import saved dashboard object). and import file.ndjson using saved_objects/_import api

Could you please help me with APIs for step no 2 and 3?

If I look at the code on [GitHub here]
(https://github.com/elastic/kibana/blob/178e20195326d74ee0ac85caabdb78bf7a8638e3/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/import.ts#L48)

It says:

"The import dashboard API '/api/kibana/dashboards/import' is deprecated. Use the saved objects import objects API '/api/saved_objects/_import' instead."

There are some docs for this API here:
kibana/docs/api/saved-objects/import.asciidoc at 178e20195326d74ee0ac85caabdb78bf7a8638e3 · elastic/kibana (github.com)

and here:

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