Is there a way to create catalog/product from commerce API?
In postman I found example "Add Catalog"
but it uses "DoUxActions
action instead of some REST method like [POST] /Catalogs
I managed to generate client code from metadata
({{OpsApiHost}}/{{ShopsApi}}/$metadata
) using Odata Connected Service
in VS
and tried to use generated method for creating new catalog
_container.AddToCatalogs(new Sitecore.Commerce.Plugin.Catalog.Catalog()
{
Name = "Test",
DisplayName = "Test",
PriceBookName = "Postman_Price_Book",
PromotionBookName = "Postman_Promotion_Book",
});
await _container.SaveChangesAsync();
but SaveChangesAsync
throws error
"System.NotSupportedException: No action match template 'Catalogs' in 'CatalogsController'"
Using postman i was able to get all routes
{{OpsApiHost}}/{{OpsApi}}/GetApiRoutes
and PUT/POST for Catalogs ins't present.
Is there a way to create catalog/product or do I have to go with DoUxAction