Export connector using saved objects api

I am trying to export connectors from few of my spaces using saved objects api
the request body looks like

body ={
    "type": "connector",
    "includeReferencesDeep": True
}

but when i do the request it says
"statusCode":400,"error":"Bad Request","message":"Trying to export non-exportable type(s): connector"
so the type of connector is not supported for now or am i missing something?
the full code looks something like

import requests
import json
from requests.auth import HTTPBasicAuth
import ndjson

kibana_url = 'https://{correct url}/kibana'

headers = {
    'kbn-xsrf': 'true'
}

body ={
    "type": "connector",
    "includeReferencesDeep": True
}

# Get a list of all spaces in Kibana
spaces_url = f'{kibana_url}/api/spaces/space'
response = requests.get(spaces_url, headers=headers, verify=True,auth=HTTPBasicAuth(CORRECT VALUES))
spaces = response.json()
# print(spaces)

for space in spaces:
    space_id = space['id']
    space_name = space['name']
    print("for space id: " + space_id)
    saved_object_url = f'{kibana_url}/s/{space_id}/api/saved_objects/_export'
    res = requests.post(saved_object_url, headers = headers,json=body ,verify=True,auth=HTTPBasicAuth(CORRECT VALUES))
    connector = res.text
    print(connector)

Hi, it could be a bug in your version of Kibana. Which version of Kibana is this?

The version is 8.6.3, I'm able to export dashboards and stuff but in type "connector" says invalid type

I believe connectors use type "action" - the original name of the feature, changed later to connector, but we left the old type name.

2 Likes

Thanks a bunch this worked for me perfectly

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