I'm trying to update contacts via REST API with forcejs and simple CURL. I'm trying to POST or PATCH a record, but all my requests have no responses. I'm trying those requests on my sandbox.

For example here is my CURL test from terminal:

curl 'https://xxx.my.salesforce.com/services/data/v41.0/sobjects/contact/xxx' 
-H 'Content-Type: application/json'  
-H 'Accept: application/json' 
-H 'Cache-Control: no-store' 
-H 'Accept-Language: en-us' 
-H 'Accept-Encoding: br, gzip, deflate' 
-H 'Authorization: Bearer xxx' 
-H 'Content-Length: 37' 
-H 'Target-URL: https://xxx.my.salesforce.com' 
-H 'X-Connect-Bearer-Urls: true' 
--data-binary '{"Title":"Updated Title"}' 

And here is the answer

[{"message":"java.util.concurrent.TimeoutException: Idle timeout expired: 120000/120000 ms","errorCode":"JSON_PARSER_ERROR"}]

And sometimes answer is

curl: (52) Empty reply from server

To tell you the truth, it did worked a couple of time (3 maybe) and then only response I see is time out. Maybe I've got blocked for making wrong requests? Or there is a quota?

  • Validate your JSON online, it seems there is some problem in your JSON.
    – MIX DML
    Jan 19, 2018 at 14:01
  • @PrabhatKumar, no, even when I remove "data-binary" part from my request, still no error, just time out.
    – Mee
    Jan 19, 2018 at 14:51
  • Also, it stoped working with GET requests as well.
    – Mee
    Jan 19, 2018 at 14:51

2 Answers 2


I think the problem is content length - your length is actually 25 chars, while you manually specify 37. Parser keeps waiting for new data until it times out.

I think you can remove this param and curl will calculate it automatically.


I think I found the solution at last. It appeared that my php-proxy was not working correctly, I expected PATCH request to return a response, which is not happening for me, so file_get_contents was waiting forever. And I thought that Empty reply from server is not a proper response. I tested my requests with external tool (Insomnia) and found that everything's working, so I replaced my php-proxy with another one and everything seems to be working.

For some strange reason CORS setup in Salesforce admin section is not working for me, it doesn't seem to save my external domain for some reason, so I need to use proxy instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .