From 2eceffd267d4f6ce41c0361585a9a1df49b25385 Mon Sep 17 00:00:00 2001 From: jlecour Date: Fri, 22 Dec 2023 09:21:52 +0100 Subject: [PATCH] Ajout de l'option --json --- HowtocURL.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/HowtocURL.md b/HowtocURL.md index 3853f369..2ea64059 100644 --- a/HowtocURL.md +++ b/HowtocURL.md @@ -165,15 +165,19 @@ Pour tester des interactions avec une API REST, on peut facilement envoyer des s En direct : ~~~ -$ curl -XPUT 'http://localhost:9200/_snapshot/foo' -d '{ -"type": "fs", - "settings": { - "location": "/home/backup-elasticsearch", - "compress": true - } -}' +$ curl -XPUT 'http://localhost:9200/_snapshot/foo' \ + --header "Content-Type: application/json"\ + --header "Accept: application/json"\ + --data '{"foo": "bar"}' ~~~ +Les versions récentes de curl supportent même l'option `--json` : + +~~~ +$ curl -XPUT 'http://localhost:9200/_snapshot/foo' --json '{"foo": "bar"}' +~~~ + + Via un fichier : ~~~