Hello,
First off, I have to say I just found http://devdocs.magento.com/swagger/ and it's REALLY helpful for figuring out the REST options for Magento! I really like it!
However, I am having a problem using the /V1/products POST call. I'm creating a new product with this data payload:
{"product":{"sku":"dave@thiba-1452876901","name":"Test Title","price":"1234","status":1,"typeId":"simple","attributeSetId":4,"storeId":2}}
According to this documentation in Swagger:
http://devdocs.magento.com/swagger/#!/catalogProductRepositoryV1/catalogProductRepositoryV1SavePost
the format looks like it should be OK. However, I'm getting this error when I use the call above:
Magento product creation result: {"message":"Property \"StoreId\" does not have corresponding setter in class \"Magento\\Catalog\\Api\\Data\\ProductInterface\"
If I drop out the storeId part it works fine. Am I doing something wrong, or has the documentation gotten ahead of the functionality implemented in the ProductInterface? It looks like it's choking on the storeId even though the documentation says I should be able to use it like that.
I really appreciate your time and consideration! Great work on M2, by the way! I'm new to Magento and I have to say once I figure out how to get all these API calls working from my external app, I think I'm really going to be happy I chose it I'm working it into a SaaS site I'm developing, and once I get it off the ground and get some income, I plan on purchasing the Enterprise support.
Best,
Dave
I figured out a potential work around for this issue, but I'm not sure if it's working right. Instead of using the storeid in the product creation, I used POST /V1/products/{sku}/websites to add the product to the correct website. Then I used POST /V1/categories/{categoryId}/products to add the product to a category.
When I go into the Magento Admin I see the product showing up under the right category and website, but when I use GET /V1/categories/14/products (14 is the right category ID) I get <response/> with no data in it.
Another weird issue is the fact that when I go into the product details in the magento backend all the fields of custom attributes are greyed out and blank and the "Store View Use Default Value" boxes are checked.
Any thoughts?
Best,
Dave
I'm having the same issue with the same API call. Were you able to figure out the solution?
I found some information here:
http://file.allitebooks.com/20151230/Magento%202%20Developer's%20Guide.pdf
If you look on page 371 that might help you some. I'm not sure why the parameters in this pdf differ from what's on the Magento 2 Developer Documentation.
Anyway I was able to get pass the error when I formatted my JSON according to what's on page 371. Let me know if you have found another solution.