Think you need to look at this page you are missing some of the headers etc.
2nd always helpful to show the response error etc.. otherwise we are just guessing
3rd I assume you are actually putting the host and port into the API call.
Example
curl -X POST \
http://localhost:5601/api/spaces/space \
-H 'Content-Type: application/json' \
-H 'kbn-xsrf: true' \
-d '{
"id": "sales",
"name": "Sales",
"description": "This is your Sales Space!",
"disabledFeatures": []
}
'
But when I add my own command:
run_elastic_curl "-XPOST" "/api/index_patterns/filebeat" "-H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '{"attributes": {"title": "filebeat*", "timeFieldName": "@timestamp"}}'"
I get this error:
FAILED with response [{"statusCode":404,"error":"Not Found","message":"Not Found"}404]
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.