Magento 2 rest api get params returns empty array can any one tell me where I am going wrong.
i/p: in postman body => raw => json
{
"orderids":[1,2,3]
}
(or)
{
"orderids":"1"
}
(or)
{
"orderids":{
"0":"1",
"1":"1",
"2":"1"
}
}
<?php
namespace Test\OrderGridSync\Model;
use Test\OrderGridSync\Api\SyncInterface;
class Sync implements SyncInterface
{
protected $_request;
public function __construct(
\Magento\Framework\App\Request\Http $request
) {
$this->_request = $request;
}
/**
* return order ids
* @api
* @param mix $orderids
* @return mix
*/
public function syncOrders() {
print_r($this->_request->getParams());
die('testing');
}
}
o/p:-
Array
(
)
testing