0

I'm using magento v2.3.4 and created a Magento 2 rest webapi function like this:

/**
 * POST for create brands api
 * @param mixed $data
 * @return array
 */
public function create($data);

I usually use the API using this URL:

http://m2.local/rest/V1/test/brands

with data like this:

{
    "data": [
        {
            "name": "Adidas",
            "type": "apparel"
        },
        { 
            "name": "Nike",
            "type": "apparel"
        }
    ]
}

The problem arise when I tried to use the async function in the REST Webapi url:

http://m2.local/rest/async/V1/test/brands

Then I got the following error:

"error_message": "Data in topic "async.vendor.module.api.brandsinterface.create.post" must be of type "mixed". "array" given."

  • Can you change the return type as mixed instead of array and re compile , it might help you – purna gattu Oct 16 at 4:39

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.