I made an API which returns wishlist of a user using customer_token as authentication, obtained via this API:
rest/V1/integration/customer/token
My webapi.xml looks something like:
<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/fetch_wishlist/" method="GET">
<service class="Vendor\WishlistApi\Api\WishlistInterface" method="setData"/>
<resources>
<resource ref="self" />
</resources>
<data>
<parameter name="customerId" force="true">%customer_id%</parameter>
</data>
</route>
</routes>
But I am getting an error as:
{
"message": "Invalid type for value: \"string\". Expected Type: \"string[]\".",
"trace": null
}
Rest of my code is correct, I used this API with anonymous resource in webapi.xml and it works fine if i send the payload as:
{"customerId": [3500]}
However I get the same exact error if I put the payload as:
{"customerId": 3500}
Any suggestions?