Skip to Content
0

DELETE Call to REST API always gets 'Invalid Content Type'

Feb 26, 2017 at 06:53 AM

204

avatar image

Hi experts,

I have an iFlow that calls a REST API - and it has the same endpoint for both POST and DELETE. I'm making the call using HTTP receiver adapters.

So the POST is working fine. However, the DELETE isn't. I always get the response from the API that says 'Invalid Content Type'. I've tried different ways to set the Content-Type:

(1) Content Modifier - Create / Content-Type / Constant / java.lang.String / application/json

(2) Script - message.setHeader("Content-Type", "application/json)

But nothing seems to work. I've also tried sending the resource to be deleted as Query parameter instead of body and I still get the same error.

This DELETE operation is working fine when I call the API using SoapUI and Postman. Which makes me believe that the issue is in HCI.

Has anyone experienced this before? Are there other ways to set the Content-Type?

Appreciate any comments. Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sriprasad Shivaram Bhat Feb 26, 2017 at 02:49 PM
0

Hello Mark,

Could you please share more details about input details you are sending.

I have tried myself deleting an entry for custom rest entity and its working fine.

And in content modifier I have not set anything except the property value.

Regards,

Sriprasad Shivaram Bhat


Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Sriprasad,

Sorry for the delay.

Here's a snapshot of my channel:

And I'm using the exact same connection details except for the Method for my other POST scenario and it's working fine. :(

capture.png (12.2 kB)
0

Hi Sriprasad,

Just want to let you know that I've raised this issue to SAP and they came back to me with the following:

"The HTTP receiver adapter currently removes the body for DELETE, HEAD, TRACE and GET requests, because some http servers have problems processing these requests when the body is sent with the request. Normally the http servers ignore the body for such requests, but as some have issues we decided to not sent the body at all.We see this as an enhancement request to add an option to also send the body for these methods (except TRACE, where it is explicitly forbidden). This extension will come as new adapter version with one of the next updates. For now you could workaround this doing the HTTP call from a groovy script."

1
Sriprasad Shivaram Bhat Mar 09, 2017 at 04:54 PM
0

thanks mark for valuable information..!

Regards,

Sriprasad Shivaram Bhat

Share
10 |10000 characters needed characters left characters exceeded