From 3fc33a3e8e2eb011599ee5c6004cbe3ac38d97ff Mon Sep 17 00:00:00 2001 From: Kaarina Tungseth Date: Fri, 17 Apr 2020 10:17:33 -0500 Subject: [PATCH] Add headers to the sample curl (#63548) (#63861) * Add headers to the sample curl At least in 7.x it doesn't work without the kbn-xsrf and json headers. * More headers to curl commands Co-authored-by: Elastic Machine Co-authored-by: Radu Gheorghe Co-authored-by: Elastic Machine --- docs/api/saved-objects/create.asciidoc | 4 ++-- docs/api/saved-objects/export.asciidoc | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/api/saved-objects/create.asciidoc b/docs/api/saved-objects/create.asciidoc index 2f35740c0f9d60..5f83513d58fe52 100644 --- a/docs/api/saved-objects/create.asciidoc +++ b/docs/api/saved-objects/create.asciidoc @@ -59,12 +59,12 @@ any data that you send to the API is properly formed. [source,sh] -------------------------------------------------- -$ curl -X POST "localhost:5601/api/saved_objects/index-pattern/my-pattern" +$ curl -X POST "localhost:5601/api/saved_objects/index-pattern/my-pattern" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d ' { "attributes": { "title": "my-pattern-*" } -} +}' -------------------------------------------------- // KIBANA diff --git a/docs/api/saved-objects/export.asciidoc b/docs/api/saved-objects/export.asciidoc index e8c762b9543a18..a992d13ed9b9c8 100644 --- a/docs/api/saved-objects/export.asciidoc +++ b/docs/api/saved-objects/export.asciidoc @@ -68,10 +68,10 @@ Export all index pattern saved objects: [source,sh] -------------------------------------------------- -$ curl -X POST "localhost:5601/api/saved_objects/_export" +$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d ' { "type": "index-pattern" -} +}' -------------------------------------------------- // KIBANA @@ -79,11 +79,11 @@ Export all index pattern saved objects and exclude the export summary from the s [source,sh] -------------------------------------------------- -$ curl -X POST "localhost:5601/api/saved_objects/_export" +$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d ' { "type": "index-pattern", "excludeExportDetails": true -} +}' -------------------------------------------------- // KIBANA @@ -91,7 +91,7 @@ Export a specific saved object: [source,sh] -------------------------------------------------- -$ curl -X POST "localhost:5601/api/saved_objects/_export" +$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d ' { "objects": [ { @@ -99,7 +99,7 @@ $ curl -X POST "localhost:5601/api/saved_objects/_export" "id": "be3733a0-9efe-11e7-acb3-3dab96693fab" } ] -} +}' -------------------------------------------------- // KIBANA @@ -107,7 +107,7 @@ Export a specific saved object and it's related objects : [source,sh] -------------------------------------------------- -$ curl -X POST "localhost:5601/api/saved_objects/_export" +$ curl -X POST "localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d ' { "objects": [ { @@ -116,6 +116,6 @@ $ curl -X POST "localhost:5601/api/saved_objects/_export" } ], "includeReferencesDeep": true -} +}' -------------------------------------------------- // KIBANA