unknown_dev2349899
unknown_dev2349899

Reputation: 1

Curl Put Request: content-type header is not supported

Trying to work through a demo with Elastic for setting the mapping with JSON. Operating in Ubuntu LTS and keep running into issues with the request.

Original Issue:

curl -XPUT "localhost:9200/stub" -d "{"test"}"

Returns an error:

curl: (3) Failed to convert “localhost to ACE; string contains a disallowed character

I have tried changing without a port to test and still get the same result. Same with trying single quotes and 127.0.0.1

Any idea what I could be missing?

Update: corrected the quotation mark irregularities, still having issues.

curl -XPUT "localhost:9200/stub" -d "{"test"}"

Returns an error:

{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

Upvotes: 0

Views: 9754

Answers (1)

l0b0
l0b0

Reputation: 58918

You have typographic quotes (“”) in the command. In Bash (and all other POSIX shells as far as I know) those are treated as literal rather than syntactic characters, so they become part of the curl argument.

This is typically caused by bad blog software + copy-pasting code from third parties, both of which should be avoided.

Upvotes: 2

Related Questions