Having some conflicts with a REST API I created. Trying to pass an array of strings; for example, "skus", but I get this error:

Invalid type for value: array. Expected type: string.


<?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/to/api/rules/group/guest" method="POST">
        <service class="{Vendor}\{Module}\Api\ProductCheckInterface" method="checkProductsAsGuest" />

        <!--this will change later-->
            <resource ref="anonymous" />



namespace {Vendor}\{Module}\Api;

interface ProductCheckInterface
     * Check a group of products with rules as a guest
     * @param string[] $skus
     * @return \{Vendor}\{Module}\Api\Data\ProductsActionInterface
    public function checkProductsAsGuest($skus);



namespace {Vendor}\{Module}\Model;

class ProductCheck implements \{Vendor}\{Module}\Api\ProductCheckInterface
     * {@inheritdoc}
    public function checkProductsAsGuest($skus)
        // code

I've went around the web, but nothing helped.

  • How's your input string look like? – PY Yick May 25 '18 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.