Can the APM Kibana objects be loaded with API call?

I am using Kibana 7.6.0, Logstash 7.6.0 & APM version 7.6.0 and would like to automate the "Load Kibana Objects" functionality that I can find in the Kibana UI at [Home] > [Add data] > APM > "Load Kibana Objects". I was unable to find the documentation online as to if there is a "curl" command that can call the API to load such objects. Looking at the Kibana logs, the closest thing I could find was:

POST /api/saved_objects/_bulk_create?overwrite=false

I tried in the developer tools, but it returns an error as it's probably malformed.

I am looking for the curl command that would let me accomplish such a thing.

Thank you,
Joey

Hey again Joey,

When you click the Load saved Kibana objects button in the APM app, it creates an APM index pattern via the saved_objects API (as it looks like you were able to partially figure out). We don't have documentation yet, but we do have an issue open to add documentation for creating APM index pattern via the API: Kibana/#52736. Pair that information with the bulk_create saved objects API and you should be able to get it to work.

It's important to note that the saved_objects API is still experimental and subject to change at any time.

Awesome thanks!

It might be possible to manually download/pipe the apm saved objects to the saved_objects API:

curl -u elastic:$KIBANAPASS \
  'https://<kibana_host>/api/kibana/home/tutorials' \
  -H 'kbn-xsrf: true' \
  | jq '.[] | select(.id == "apm") | .savedObjects' \
  > apm_saved_objects.json
curl -u elastic:$KIBANAPASS \
  'https://<kibana_host>/api/saved_objects/_bulk_create?overwrite=false' \
  -X POST -H 'kbn-xsrf: true' -H 'Content-Type: application/json' \
  --data @apm_saved_objects.json

Note that this example uses jq to filter the tutorial data to select only the savedObjects data of the apm tutorial definition.

This is essentially the manual equivalent to how Kibana handles that button click for "Load Kibana Objects", but the tutorial API is not a public API, and may change between releases.

1 Like

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