Consuming DELETE API - request body is missing

0
I am consuming some delete api from microflow. That API is accepting request body is following format: [“Data”] So it is list of string only. I set my log level to trace and found that request body is not getting sent in request, only header are getting sent . So as a result, API is thowing an exception that “Required request body is missing”     Request that being sent: Request content for DELETE request to <MY_API> Authorization: (omitted) Idtoken: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkhtVGhHX2E2ekhKRDVuQmxZWmltSXRxNVR1ZFhMSzZkYV9YeURCWjlGSmMifQ.eyJzdWIiOiJ3ZWJrZXl8c2FjaGluLnRla2FsZS5leHRAc2llbWVucy5jb218MzU3MDAwNGQ4ZmYzNDdiZmIxNTJjYzc4ZmIxMzZiODB8M2E5YzdiMGFiY2M5NDM0NGFlZmQ5OWU2ZDNmMjJjZWQiLCJlbWFpbCI6InNhY2hpbi50ZWthbGUuZXh0QHNpZW1lbnMuY29tIiwiZ2l2ZW5fbmFtZSI6InNhY2hpbiIsImZhbWlseV9uYW1lIjoiVGVrYWxlIiwiYWNjb3VudCI6IjM1NzAwMDRkOGZmMzQ3YmZiMTUyY2M3OGZiMTM2YjgwIiwidXNlcmlkIjoiM2E5YzdiMGFiY2M5NDM0NGFlZmQ5OWU2ZDNmMjJjZWQiLCJodHRwczovL3N3cy5zaWVtZW5zLmNvbS9zYW0vY2xhaW1zL3RlbmFudE5hbWUiOiJDRiBDbG91ZCBDb25zb2xlIC0gUHJvZHVjdGlvbiIsImh0dHBzOi8vc3dzLnNpZW1lbnMuY29tL3NhbS9jbGFpbXMvdGVuYW50SWQiOiIzNTcwMDA0ZDhmZjM0N2JmYjE1MmNjNzhmYjEzNmI4MCIsImF1dGhfdGltZSI6MTU2OTQ5MTY2OCwibm9uY2UiOiJnaEY0VnFScXlMdllmN0hNQ1paNUJ0a24wcjBPVFA0eXd2dEZXQjNpV0F3IiwiYXRfaGFzaCI6Ilg2Y1lWRDJjWmZKOXh5ZHRQdWZOYVEiLCJzaWQiOiJhZTUzODE0NS04NGMyLTQxMzYtOGQ5Ni0wNGFjYjcwYjBmNDUiLCJhdWQiOiJlMGU4M2VmZC04OWFkLTRlZjQtYmNmZC04ODE5MjZlYjE2YTkiLCJleHAiOjE1Njk0OTg4NjksImlhdCI6MTU2OTQ5MTY2OSwiaXNzIjoiaHR0cHM6Ly9zYW1hdXRoLnVzLWVhc3QtMS5zd3Muc2llbWVucy5jb20vIn0.JFZ1rUln-Xj2vO5z-yoed0OCIRX_NW556WGEELi2v_Jugel-iwCw9hs8X7nen1sQ3mbN_ZYLfjiAeIUATj2Ia1Nl04qoRM6ZyK0L1CuCmxJeP4eKGqSgwA-CwVnTfXLoWebU3Vi6hWAgC2of2mmvH1dP9CnTXPe21c_-BdOU_sKx4p2lUQxaRWkWQiEfpyszSbVedGnsQ2jXPj13bPJExbomFMRgQMLyPuVJ88Oi7nAogjoO0IrIsGN4g_QGrCH1COXa4oylDjElpRDLinTQgZkINP9jWWFwmKbPUKa4vcGwKZrRogKNF7ZH9JHUAT8WwQkfWulL3iP2EMbN2zzOCg Content-Type: application/json Response from API :  Response content for DELETE request to <MY_API> HTTP/1.1 422 Date: Thu, 26 Sep 2019 09:54:49 GMT Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Set-Cookie: JSESSIONID=B074C952257A9F87E594BF4500F2E282; Domain <MY_DOMAIN>; HttpOnly Strict-Transport-Security: max-age=31450000; includeSubDomains Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT Access-Control-Max-Age: 3600 Access-Control-Allow-Credentials: false Access-Control-Allow-Headers: Content-Type,Authorization,userId,Idtoken Cache-Control: no-cache, no-store, max-age=0, must-revalidate X-XSS-Protection: 1; mode=block X-Frame-Options: DENY Strict-Transport-Security: max-age=31450000; includeSubDomains X-Content-Type-Options: nosniff {"message":"Required request body is missing: <Path to my Java class>(java.lang.String,java.util.List<java.lang.String>)","details":"uri=/additionallinks"} What is going wrong ?  
asked
3 answers
1

This may be a bug.

I tried adding a body to one of my DELETE REST calls and it was also missing.

Looking at the spec for DELETE, it seems that a body is permitted, but it is not usually recommended or implemented by clients. 

I would suggest raising a support a ticket with Mendix.

answered
0

This is to generic, how is your setup for the API call?

answered
0

Hi Rushikesh,

I ran into this problem too and found out that Requests can only be generated for HTTP methods POST, PUT, PATCH, and OPTIONS (see Mendix documentation https://docs.mendix.com/refguide/call-rest-action section 4).

The API I am consuming also supports parameters for a DELETE call, but reading your information it seems that you're not that fornunate 

answered