Skip to Content
0
Oct 31, 2019 at 09:22 AM

Using http PATCH method to pass JSON content

160 Views Last edit Oct 31, 2019 at 09:36 AM 2 rev

Hi experts,

I am using class CL_REST_HTTP_CLIENT to make GET and POST requests to an external API, passing content in JSON format.

Now I am facing the requirement to make PATCH requests. Of course, the CL_REST_HTTP_CLIENT has no PATCH method.

The stack I am on is ERP EHP8. I found various solutions for SAP PI systems, which don't help, because I cannot rely on a PI system being available.

What I have found and implemented is SAP note 2538571, which grants the ability to enhance class /IWCOR/CL_REST_RESOURCE (which also has no patch method).

I have not used this class before, so now I am looking for guidance on the next steps.

1. Is there a code example somewhere of how to make even a basic HTTP request using class class /IWCOR/CL_REST_RESOURCE (such as a POST request) that passes JSON content to an external API? I only found examples for oData.

2. Is there a better way to make a PATCH request in my situation than what I am looking at?

Thanks for your help!

All the best

Martin