I am trying to implement some functionality with DatedCoversionDate object. Unfortunately it is not possible to change it with DML but there is a way to use API calls.

here is an example

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/data/v47.0/sobjects/DatedConversionRate/');
req.setBody('{ "IsoCode" : "UAH", "ConversionRate" : 24.55, "StartDate" : "2019-12-11" }');
req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId());
req.setHeader('Content-Type', 'application/json');
req.setHeader('Cookie', 'debug_logs=1');
HttpResponse res = h.send(req);

In general, it works fine. But during development there are sometimes errors and I get the next response:

16:53:23:207 USER_DEBUG [39]|DEBUG|System.HttpResponse[Status=Bad Request, StatusCode=400]

Which is really not much useful. Is there a way to find some more information what went wrong on the server during the call? Because now I have to guess and that takes really a lot of time.

Thanks in advance.

1 Answer 1


If you already have the currency rates for the given date, you would get the HTTP 400 error when trying to create it again.

  • yes, thanks. That was the case, which I found by a method of trials. But is there a way to find more information than just HTTP 400 response
    – ypeskov
    Dec 10, 2019 at 15:11
  • HttpResponse.getBody() will reveal the actual message that you are looking for. Dec 11, 2019 at 4:54
  • Thanks a lot! That's exactly what I was looking for.
    – ypeskov
    Dec 11, 2019 at 8:09

You must log in to answer this question.

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