I assume that you have already created a web service interface and the model that implements that interface. In the implementing model, you can get the requested body content by Injecting
Magento\Framework\Webapi\Rest\Request
class instead of
Magento\Framework\App\RequestInterface
Here is the sample class to do so:
request = $request; } /** * {@inheritdoc} */ public function getSomeInfo() { // This function will get the body content of the request $body = $this->request->getBodyParams(); var_dump($body); return [ ["foo" => 'bar'], ]; } }
Comments