How to submit multiline cURL commands on Windows 10


(Srinivas) #1

I am able to successfully install ELK stack and test.

I can successfully submit cURL commands on windows 10 command prompt. But facing issues when I have to submit multi line commands.

I could not install sense as I could not find proper documentation for installing sens on windows.

I have installed marvel but do not know how to use that for cUrl commands.

I have installed PostMan app on Google but that keeps showing some 403 error message and is unable to submit commands successfully.

Once I am able to crack this cURL thing, I should be able to get my hands dirty with ElasticSearch.

Thanks in advance for advise.

Srinivas


(Mark Walkom) #2

It's the same commands irrespective of the OS.


(Srinivas) #3

Hi Mark,

Thanks for your reply.

My problem here is I am not sure how I could type multi line cUrl statements and submit on windows command prompt.

single line statements are executed successfully.


(David Pilato) #4

Install SENSE or a plugin for your browser which helps with REST commands.

Curl on windows is a nightmare


(Julian Niemeyer) #5

A bit late (sorry to bump an old post) but this is something I have hit with our Windows installation.

Many of the code snippets shown in the tutorial etc are written for Linux systems (I guess most people are using Linux for Elasticsearch?) so I will share a few of the "Windows-isms" I have found so far.

If we look at one line from the Tutorial:

curl 'localhost:9200/_cat/indices?v'

This will fail on Windows:

curl: (6) Could not resolve host: 'localhost

Use double quotes (or no quotes) instead:

curl "localhost:9200/_cat/indices?v"
or
curl localhost:9200/_cat/indices?v

Both work. Now, to split across lines using the same example, use the ^ (caret symbol) at the end of each line. If you do this interactively (as I show below) you will be prompted "More?" at the start of each new line.

curl localhost:9200/^
More? _cat/indices?v

You can also do this in a batch file:

copy con test.bat
curl localhost:9200/^
_cat/indices?v
^Z
        1 file(s) copied.

test

This will achieve the same output.

I hope this helps - and I will share more Windows-isms as they come to light.


(system) #6