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

Removing a reference in the SAP Commerce Cloud Integration API

former_member751952
Discoverer
764

Following the tutorial at https://help.sap.com/viewer/50c996852b32456c96d3161a95544cdb/2011/en-US/5d25b237f27644749b32e35d1547... and the surrounding documentation I was able to create an Integration API via which I can create categories and even put products into that category by sending a body like

{
    "@odata.context": "$metadata#Categories/$entity",
    "code": "cat-006",
    "products": [
        {
            "code": "product-001",
            "catalogVersion": {
                "catalog": {
                    "id": "Default"
                },
                "version": "Staged"
            }
        }
    ],
    "catalogVersion": {
        "catalog": {
            "id": "Default"
        },
        "version": "Staged"
    }
}

But how can I remove a product from the category. None of these things I tried worked:

* Sending an empty products array or null

* Sending a different product in the array (will be appended to teh existing products)

* Using PUT to the resource URL (I get a "credentials provided are not authorized for the operation", my api user is in the admingroup)

* Using DELETE on different variantions of $link URLs like /Categories('Staged%7CDefault%7Ccat-006')/$links/Products('')

How can I achieve to either replace the list of products in this category with a new one or at least remove the references so the category is empty?

I'm using a SAP Commerce Cloud v2 (managed, running on Azure) in the current version 2011.

Accepted Solutions (1)

Accepted Solutions (1)

former_member751952
Discoverer
0 Kudos

As I found out myself, via the PATCH operation it's possible to set the list of products to the exact value you want

Answers (1)

Answers (1)

0 Kudos

Hi Phillipp,

i tried to use "Patch" operation, but the api response with the following message:

{ "error": { "code": null, "message": { "lang": "en", "value": "The request dispatcher does not allow the HTTP method used for the request." } }}¿can you help me please?