anybody knows how to troubleshoot this?
Magento 2 WebAPI Error – Class ‘Array’ Does Not Exist
apimagento2
Related Topic
- Magento – Magento 2 Class does not exist error
- Magento2 – Fix Error: Class PbuploadMediaGridDataProvider Does Not Exist
- Magento 2 – Fixing Error: Factory Class Does Not Exist
- Magento – class [] does not exist for custom extension_attributes over webapi
- Magento – “Class mixed does not exist” with only one array param in the body in Magento 2
- Magento – Magento 2 Error: Class does not exist
- Magento – Class interceptor does not exist magento 2
Best Answer
When ever you are using Rest API in Magento 2. You have to follow these steps :
While creating interface and model, we define parameters DocBlock annotation and return DocBlock annotations in both file and it should match in bothe the file. Example given below :
If you are miss matching parameters data type in DocBlock annotation of either interface or model you can face this error "Class “array” does not exist"
OR
If you are passing wrong parameter's data type in postman or API call you will face this 'Class “array” does not exist issue.
So check parameter's data type every where and it should be same.
Check screenshot for the same error I faced as it entered wrong data type in interface annotation
I got this error when i changed datatype of parameter from string to array in interface :
I hope this will help you to figure out your issue.