curl: (3) unmatched brace in URL position 1:
I replaced the single quotes with double quote and escaped the double quotes inside the curly braces with a backslash and it has worked.
I went from this:
curl --X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name":"name", "type":"text_general", "multiValued":false, "stored":true}}' http://localhost:8983/solr/films/schema
to this:
curl --X POST -H "Content-type:application/json" --data-binary "{\"add-field\": {\"name\":\"name\", \"type\":\"text_general\", \"multiValued\":false, \"stored\":true}}" http://localhost:8983/solr/films/schema
Thank you everybody for your collective answers. I am sure there are some possible positives to adding the JSON
to a separate file but i wanted to avoid the creation of additional files.
The Windows command prompt doesn't support single quotes. It's a problem because cURL statements use single quotes to specify JSON data.
To fix the problem, save the JSON in a separate file (e.g. add-field.txt
) and import it into the cURL statement, so later you could run it like this:
curl -X POST -H 'Content-type:application/json' --data-binary @add-field.txt http://localhost:8983/solr/films/schema