cancel
Showing results for 
Search instead for 
Did you mean: 

Update SAP Commerce Product features over Integration API

S0011572494
Participant
0 Kudos
1,248

With SAP Commerce 1808 the integration api with the according cockpit was introduced which enables creating a ODATA webservice for a certain type dynamically.

I tried to create a product and its classification attributes via this api as we get them from an external system.
Unfortunately I didn't find out how to create product feature values correctly.

When I send a product and its features as a POST request to my IntegrationObject, the item is created but the feature cannot be rendered correctly in Backoffice. The feature is displayed (Filtergrösse - de - 5.0) but is not editable and the unit is not shown.

How can we update classification attributes correctly?

The code is tested with a default 1905 version.

Impex for the integration object

INSERT_UPDATE IntegrationObject; code[unique = true]; integrationType(code) 
; ProductsUpImport; INBOUND 
 
INSERT_UPDATE IntegrationObjectItem; integrationObject(code)[unique = true]; code[unique = true]; type(code); root[default = false] 
; ProductsUpImport    ; ClassificationAttribute        ; ClassificationAttribute        ;     ;  
; ProductsUpImport    ; MediaContainer                 ; MediaContainer                 ;     ;  
; ProductsUpImport    ; ClassAttributeAssignment       ; ClassAttributeAssignment       ;     ;  
; ProductsUpImport    ; Product                        ; Product                        ; true    ;  
; ProductsUpImport    ; Category                       ; Category                       ;     ;  
; ProductsUpImport    ; Language                       ; Language                       ;     ;  
; ProductsUpImport    ; ProductFeature                 ; ProductFeature                 ;     ;  
; ProductsUpImport    ; CatalogVersion                 ; CatalogVersion                 ;     ;  
; ProductsUpImport    ; ClassificationClass            ; ClassificationClass            ;     ;  
; ProductsUpImport    ; Catalog                        ; Catalog                        ;     ;  
; ProductsUpImport    ; ClassificationSystemVersion    ; ClassificationSystemVersion    ;     ;  
; ProductsUpImport    ; ClassificationAttributeUnit    ; ClassificationAttributeUnit    ;     ;  
; ProductsUpImport    ; ClassificationSystem           ; ClassificationSystem           ;     ;  
 
INSERT_UPDATE IntegrationObjectItemAttribute; integrationObjectItem(integrationObject(code), code)[unique = true]; attributeName[unique = true]; attributeDescriptor(enclosingType(code), qualifier); returnIntegrationObjectItem(integrationObject(code), code); unique[default = false]; autoCreate[default = false] 
; ProductsUpImport:ClassificationAttribute        ; systemVersion                        ; ClassificationAttribute:systemVersion               ; ProductsUpImport:ClassificationSystemVersion    ; true    ;  
; ProductsUpImport:ClassificationAttribute        ; code                                 ; ClassificationAttribute:code                        ;                                                 ; true    ;  
; ProductsUpImport:MediaContainer                 ; catalogVersion                       ; MediaContainer:catalogVersion                       ; ProductsUpImport:CatalogVersion                 ; true    ;  
; ProductsUpImport:MediaContainer                 ; qualifier                            ; MediaContainer:qualifier                            ;                                                 ; true    ;  
; ProductsUpImport:ClassAttributeAssignment       ; classificationClass                  ; ClassAttributeAssignment:classificationClass        ; ProductsUpImport:ClassificationClass            ; true    ;  
; ProductsUpImport:ClassAttributeAssignment       ; classificationAttribute              ; ClassAttributeAssignment:classificationAttribute    ; ProductsUpImport:ClassificationAttribute        ; true    ;  
; ProductsUpImport:Product                        ; supercategories                      ; Product:supercategories                             ; ProductsUpImport:Category                       ;     ;  
; ProductsUpImport:Product                        ; features                             ; Product:features                                    ; ProductsUpImport:ProductFeature                 ;     ;  
; ProductsUpImport:Product                        ; code                                 ; Product:code                                        ;                                                 ; true    ;  
; ProductsUpImport:Product                        ; galleryImages                        ; Product:galleryImages                               ; ProductsUpImport:MediaContainer                 ;     ;  
; ProductsUpImport:Product                        ; catalogVersion                       ; Product:catalogVersion                              ; ProductsUpImport:CatalogVersion                 ; true    ;  
; ProductsUpImport:Product                        ; name                                 ; Product:name                                        ;                                                 ;     ;  
; ProductsUpImport:Category                       ; catalogVersion                       ; Category:catalogVersion                             ; ProductsUpImport:CatalogVersion                 ; true    ;  
; ProductsUpImport:Category                       ; code                                 ; Category:code                                       ;                                                 ; true    ;  
; ProductsUpImport:Language                       ; isocode                              ; Language:isocode                                    ;                                                 ; true    ;  
; ProductsUpImport:ProductFeature                 ; product                              ; ProductFeature:product                              ; ProductsUpImport:Product                        ; true    ;  
; ProductsUpImport:ProductFeature                 ; qualifier                            ; ProductFeature:qualifier                            ;                                                 ; true    ;  
; ProductsUpImport:ProductFeature                 ; unit                                 ; ProductFeature:unit                                 ; ProductsUpImport:ClassificationAttributeUnit    ; true    ;  
; ProductsUpImport:ProductFeature                 ; classificationAttributeAssignment    ; ProductFeature:classificationAttributeAssignment    ; ProductsUpImport:ClassAttributeAssignment       ;     ;  
; ProductsUpImport:ProductFeature                 ; value                                ; ProductFeature:value                                ;                                                 ;     ;  
; ProductsUpImport:ProductFeature                 ; language                             ; ProductFeature:language                             ; ProductsUpImport:Language                       ; true    ;  
; ProductsUpImport:CatalogVersion                 ; catalog                              ; CatalogVersion:catalog                              ; ProductsUpImport:Catalog                        ; true    ;  
; ProductsUpImport:CatalogVersion                 ; version                              ; CatalogVersion:version                              ;                                                 ; true    ;  
; ProductsUpImport:ClassificationClass            ; code                                 ; ClassificationClass:code                            ;                                                 ; true    ;  
; ProductsUpImport:ClassificationClass            ; catalogVersion                       ; ClassificationClass:catalogVersion                  ; ProductsUpImport:ClassificationSystemVersion    ; true    ;  
; ProductsUpImport:Catalog                        ; id                                   ; Catalog:id                                          ;                                                 ; true    ;  
; ProductsUpImport:ClassificationSystemVersion    ; catalog                              ; ClassificationSystemVersion:catalog                 ; ProductsUpImport:ClassificationSystem           ; true    ;  
; ProductsUpImport:ClassificationSystemVersion    ; version                              ; ClassificationSystemVersion:version                 ;                                                 ; true    ;  
; ProductsUpImport:ClassificationAttributeUnit    ; code                                 ; ClassificationAttributeUnit:code                    ;                                                 ; true    ;  
; ProductsUpImport:ClassificationAttributeUnit    ; systemVersion                        ; ClassificationAttributeUnit:systemVersion           ; ProductsUpImport:ClassificationSystemVersion    ; true    ;  
; ProductsUpImport:ClassificationSystem           ; id                                   ; ClassificationSystem:id                             ;                                                 ; true    ;  

Testwebservice

POST https://localhost:9002/odata2webservices/ProductsUpImport/Products

JSON Payload

{
    "@odata.context": "$metadata#Product/$entity",
    "code": "test_article_features",
    "catalogVersion": {
        "catalog": {
            "id": "Default"
        },
             "version": "Staged"
    },
    "supercategories" : [
        {
            "code": "1093",
            "catalogVersion": {
                "catalog": {
                    "id" : "ElectronicsClassification"
                },
                "version": "1.0"
            }
        }
    ],
    "features": [
        {
            "qualifier": "ElectronicsClassification/1.0/1093.filter size, 1615",
            "product" : {
                "code": "test_article_features",
                "catalogVersion": {
                    "catalog": {
                        "id": "Default"
                    },
                         "version": "Staged"
                }
            },
            "classificationAttributeAssignment" : {
                "classificationClass": {
                    "code": "1093",
                    "catalogVersion": {
                        "catalog": {
                            "id" : "ElectronicsClassification"
                        },
                        "version": "1.0"
                    }
                },
                "classificationAttribute": {
                    "code": "Filter size, 1615",
                    "systemVersion": {
                        "catalog": {
                            "id" : "ElectronicsClassification"
                        },
                        "version": "1.0"
                    }
                }
            },
            "value": 5.0,
            "language": {
                "isocode": "de"
            },
            "unit": {
                "code": "24",
                "systemVersion": {
                        "catalog": {
                            "id" : "ElectronicsClassification"
                        },
                        "version": "1.0"
                    }
            }
        }
        ]
}

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

I have the same question I see that for impex you can make use of a translator i.e.

de.hybris.platform.catalog.jalo.classification.impex.ProductFeatureValueTranslator

But how would you achieve this with the integration API?

Best Regards,

Björn van den Broek


rahulverma94
Active Participant
0 Kudos

Hi fabian.saccilotto ,

How did you resolve the issue? What was wrong in the request?

Regards
Rahul

S0011572494
Participant
0 Kudos

Well unfortunately I cannot give you a good answer.

We did not use the integration API at this point because of the above and other issues. We used a custom API / Impex Adapter.