cancel
Showing results for 
Search instead for 
Did you mean: 

CPI - HTTP Receiver Adapter for REST API - json payload error

laurentdoyen
Discoverer
3,919

Hi community experts,

Looking for advice to resolve an issue while executing a POST to an external REST API. The payload is simple and is in JSON format.

I am using the HTTP receiver adapter and have tried several configurations, for example with POST method and Dynamic method (with Send Body flag ticked). All attempts result in a HTTP 403 error. I can see in the monitor that the payload appears to be passed correctly to the Receiver adapter. For example an extract of the payload looks like this:

{"interview":{"title":"Test1","due_date":"2019-12-06T10:10:10Z", ...... }}

However the receiving 3rd party system indicates their logs shows the following type of payload with escape characters:

{"{\n \interview\": {\n \"title\": \"Test1\",\n \"due_date\": \"2019-12-06T10:10:10Z\",\n ..... }}

However when testing the same source JSON payload in a test tool such as Postman (POST to 3rd party API URL) the result is a success response (200 OK).

It appears the CPI HTTP receiver adapter seems to transform the payload by adding escape characters. How can I avoid that behaviour and how can I track what is happening? The CPI message monitor (with Trace enabled) does not provide enough details. It shows the payload before the error but no detail on what the adapter sends to the API.

It is also worth noting that GET requests from CPI to the same external REST API (different endpoint but same host) is successful. Obviously the difference is that GET does not include a payload body.

Any input would be appreciated.

Thanks.

Laurent

View Entire Topic
0 Kudos

Hi Laurent,

if your issue still not solved, read this Blog: https://blogs.sap.com/?p=896320

I believe you might have a similar Issue where CPI adds Linux line endings, while Postman adds Windows line endings.

Regards

Saraj