amazon-web-servicescurlkibanaopensearchhttp-status-code-406

Unable to import Kibana Dashbord using api


I exported a dashboard and have been attempting to import it using the Kibana API.

On making the below curl request

curl -X POST -u  <USERNAME>:<PASSWORD> <URL>  -H "kbn-xsrf: true" --form file=@export.ndjson -H 'kbn-xsrf: true'  

I'm getting the response as:

{"error":"Content-Type header [multipart/form-data; boundary=------------------------0506088858c35b19] is not supported","status":406}%

Note: I'm using AWS managed Opensearch

Can someone help me to please fix this error?

Thanks in advance :)


Solution

  • I was able to fix this issue by augmenting few header key-val pairs.

        'kbn-xsrf': 'true',
        "Accept": "*/*",
        "Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8",
        "Accept-Encoding": "gzip, deflate, br",
        'osd-xsrf': 'true'