Freshdesk request method relays empty body to REST endpoint

Hi there,

I’m currently developing a Freshdesk Custom App and need to do some calls to a custom REST service. GET requests are working fine with the request method. But for POST methods, the body never gets forwarded to the endpoint and is always empty.

FDK 14732: (proxy.js) Making proxy call with options as {"headers":{"Authorization":"XXXXX"},"body":"Hello world","url":"https://OUR_CUSTOM_API/api/v1/orders/","method":"post","maxAttempts":1,"retryDelay":0,"timeout":5000}

I tried it with json-data (of course encoded with JSON.stringify) and simple strings (like in the log example). The body received by the REST API is always empty. If I call the API via Postman it’s working, So no need to mistrust the API itself.

I tried multiple FDK versions (with 6.9.0 being the most current one) and also using PUT instead of POST. Nothing helps.

Do you have any thoughts on that?

1 Like

Hi @trustthe27,

I will try it out if I can replicate it with FDK.

Meanwhile, could you try to send a JSON-serialized input to json attribute instead of body attribute in options?

@trustthe27

Appreciate the great clarity in describing the issue and way you’ve tried. I am on FDK 6.9.0 and tried to make request with client.request.post(..)

My FDK debug logs have shown the body getting attached in immedidate proxy.js

FDK 7619: (proxy.js) Parsed https://postman-echo.com/post/hi/there?hand=wave as {"protocol":"https:","slashes":true,"auth":null,"host":"postman-echo.com","port":null,"hostname":"postman-echo.com","hash":null,"search":"?hand=wave","query":"hand=wave","pathname":"/post/hi/there","path":"/post/hi/there?hand=wave","href":"https://postman-echo.com/post/hi/there?hand=wave"}
FDK 7619: (proxy.js) Making proxy call with options as {"headers":{"Content-Type":"application/json"},"body":"{\"status\":2,\"priority\":1,\"description\":\"Test\",\"subject\":\" Hello there\",\"email\":\"tom@outerspace.com\"}","url":"https://postman-echo.com/post/hi/there?hand=wave","method":"post","maxAttempts":1,"retryDelay":0,"timeout":5000}

As @Raviraj requested, a JSON serialized string can help us a little more to understand if CLI is doing some validation to remove body? Or, Also, can you share the code snippet of which you are making this POST request? That way, we get a chance to look at additional attributes you have added which can be a silent cause.