I am working on a custom API in which user will pass the request like below in JSON.
{ "cartItem": [ { "sku": "11223344", "qty": 1 }, { "sku": "55667788", "qty": 1 } ] }
I tried to get it done like this.
interface CartItemInterface extends CustomAttributesDataInterface
{
const CART_ITEM = 'cartItem';
/**
* Return list of Cart Items
* @return \Test\TestApi\Api\Data\CartItemListInterface[]
*/
public function getCartItem();
/**
* @param array $cartItemList
*/
public function setCartItem(array $cartItemList);
}
But it gives me this error every time, after so many changes in the logic.
"message": "Property "0" does not have accessor method "get0" in class Test\TestApi\Api\Data\CartItemInterface,
Please help me with code how to fix this problem and receive this request in which multiple array of key value pairs.