cancel
Showing results for 
Search instead for 
Did you mean: 

SAP RAP Web API - Modify response body

saurabh__khare
Participant
0 Kudos
1,365

Hi,

We've exposed a RAP service as an OData V4 Web API. It works as expected. Just that the default response of the POST call contains all the fields of the entity and the child entity when the request is successful. Is there a way to control/modify the response body(delete certain fields/send a generic response) before sending it to the consumer? Note that is a managed RAP BO with unmanaged save. The consumer triggers a create request, data is persisted in a custom DB table in the unmanaged save sequence and the control returns to the RAP framework for response generation.

Current default sample response:

saurkhare_0-1716577781488.png

Expected Response:
{ "Success" } or no response at all with HTTP status 200 would also work.

Any suggestions?

@JessieCheah @Andre_Fischer 

View Entire Topic
saurabh__khare
Participant
0 Kudos

 Hi Vitali,

Thank you for your response. I think that would work for us.

Regards,

Saurabh

0 Kudos
May i know how you did this , I also have same requirement with unmanaged scenario but when i am trying to add ?$select=FieldName in my post query it is giving me problem that The Data Services Request contains SystemQueryOptions that are not allowed for this Request Type
saurabh__khare
Participant
0 Kudos

Hi,

This did not work for us as well using RAP Web API. Not sure if this works in public cloud systems or BTP ABAP env. On on-premise/private cloud it does not.

.../sap/opu/odata4/sap/zfi_api_invoiceapi_o4/srvd_a2x/sap/zfi_api_invoiceapi_o4/0001/InvoiceAPI?sap-client=200&$select=InvUUID

"message": "The requested URI allows the system query options: '$expand,$format'"
 
So $select does not work. @vhardzeyenka: How did you create your service? Is it a RAP-based service or SEGW?
0 Kudos
It’s a RAP based API