I am trying to create a custom plugin which needs to read the body of the request (by body i mean json data that is sent along with the request)
so i should be able to read the json data of a request like
POST myendpoint
{
"somefield": "somevalue",
"anotherfield": "anothervalue"
}
i currently have created a catAction, but it shows this error when i try to send a body
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "request [POST /myendpoint] does not support having a body"
}
],
"type" : "illegal_argument_exception",
"reason" : "request [POST /myendpoint] does not support having a body"
},
"status" : 400
}
Edit : after i changed message to be = request.content().toutf8String()
i was able to see the send the body, and the message was the same as body, but in string
how do i convert this into an object?
I know i can use json parsers, but i don't think that is a proper way.
I wanted to know how the _snapshot or other apis handle the body?
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.