I have a POST endpoint that receives a JSON payload.
I'm using the Magento\Framework\App\Request\Http
class to try and retrieve my POST data.
If I run $data = $this->request->getPost();
, then $data
will be empty.
However if I run $data = file_get_contents('php://input');
I am able to view my JSON payload as a string.
Is there a way to grab this natively through Magento?
FWIW I'm testing this through a rest/V1 endpoint through Postman.
This is a POST request with a chunk of (valid) JSON data in the raw data type.
$this->request->getContent();