cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Add a product to a category with rest webservices

former_member633554
Active Participant
0 Likes
181

This might help someone in the future, as i just spent an hour trying to figure it out. I kept getting this error

 Error processing request (invalid or malformed content?)
 Error getting entity for current request body [BadRequestException]
 Found 2 results for the given example [ProductModel (
 <unsaved>)]. Specify the example model in more detail. Searched with these attributes: {code=GB12} [AmbiguousIdentifierException]

This would put the product with code GB12 into the category with code PAZ (in the staged catalogversion of a product catalog)

PUT http://127.0.0.1:9001/ws410/rest/catalogs/ProductCatalog/catalogversions/Staged/categories/PAZ

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <category code="PAZ" pk="8796360310926" uri="http://127.0.0.1:9001/ws410/rest/catalogs/ProductCatalog/catalogversions/Staged/categories/PAZ">
    
   <products>
         <product code="GB12" pk="8798411030529" uri="http://127.0.0.1:9001/ws410/rest/catalogs/ProductCatalog/catalogversions/Staged/products/GB12">
             
              <catalogVersion version="Staged">
                      <catalog id="ProductCatalog"/>
             </catalogVersion>
     
             </product>
     </products>
 
 </category>

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member633554
Active Participant
0 Likes

The only limitation to this approach is it wipes all the other categories from the product! Back to the drawing board :)