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

Marketing Cloud Product Update - SAP API Hub PATCH doesn't work

SCHNEIDERT
Active Contributor
0 Kudos
446

Hi everyone,

has anyone already successfully tried to update a product in SAP Marketing Cloud using SAP API Business Hub?

I wanted to add a ProductImageURL to an existing Product in our SAP Marketing Cloud Tenant.

First I do a GET Request to the /ProductOriginDataSet and fetch a x-csrf-token.

After that I do a PATCH to the /ProductOriginDataSet including the ProductOrigin and ProductID and adapted the body with the ProductImageURL and so on (and also added the x-csrf-token to the header).

So the request URL looks like that:

https://myxxxxxx.s4hana.ondemand.com:443/sap/opu/odata/sap/API_MKT_PRODUCT_SRV;v=0002/ProductOriginDataSet(ProductOrigin='SAP_S4H_PRODUCT',ProductID='30681')

As response I get the error message "Method PRODUCTS_UPDATE_ENTITY not implemented...."

Does anyone have an idea what might be the problem and how to solve that?

BR Tobias

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee

Hi Tobias,

API_MKT_PRODUCT_SRV support PATCH operation BUT only with batch mode.You cannot really call PATCH method directly for API endpoints ***API_MKT_PRODUCT_SRV;v=0002/ProductOriginDataSet(ProductOrigin='SAP_S4H_PRODUCT',ProductID='30681').

Hence, You neeed to call https://my30XXXX-api.s4hana.ondemand.com:443/sap/opu/odata/sap/API_MKT_PRODUCT_SRV;v=0002/$batch with POST method and then pass the payload.

batch.txt

Note: That batch mode is white spacing sensitive i.e. even a additional line break could cause API call failure.

BR

Saurabh

SCHNEIDERT
Active Contributor
0 Kudos

Hi Saurabh,

thanks for your answer.

So it is not possible to use the "Try out" function in the SAP API Business Hub?

When I try to use Postman using the endpoint you provided with POST, I get the response "The server is refusing to process the request because the entity has an unsupported format".

How does your header look like? I added the keys

"x-csrf-token" with the token as value,

"Accept" with value "application/json" and

"Content-Type" --> If I changed it from "application/json" to "multipart/mixed, boundary=batch" then I get the error message "Batch request payload is invalid" (using the payload provided by you).

Any further ideas?

BR Tobias

former_member226
Employee
Employee
0 Kudos

Hi Tobias,

I am not sure about batch mode possibility in API hub as I use postman for testing batch mode 😞

If you are using my text file payload then you need to change Content-Type from multipart/mixed, boundary=batch to multipart/mixed; boundary=batch_guid_01

header.png

payload.png

BR
Saurabh

SCHNEIDERT
Active Contributor
0 Kudos

Hi Saurabh,

thank you, now it works as expected! 🙂

Answers (2)

Answers (2)

KunalBansal
SAP Champion
SAP Champion

Hi Tobias,

Have you checked the https://api.sap.com/api/API_MKT_PRODUCT_SRV/resource

and of SAP Help Page Payload example for API_MKT_PRODUCT_SRV.

Also, check the metadata call.

best regards,

Kunal

former_member1277
Participant
0 Kudos

Do we need to this in batch mode ?