1

I have a requirment to integrate a .net system with Salesforce using REST API. In that I need to show a proper error message on request payload error.

From .net system I get proper error status like "400 BillingAddress is not complete", tested this in "Advance REST client" in Chrome. enter image description here

But in Salesforce I get the response like "System.HttpResponse[Status=Bad Request, StatusCode=400]".

I am getting a correct StatusCode but not Status. Used getStatus() method and getBody() method. Can anyone please let me know how to get the Status using REST API.

2
  • so you don't see the "BillingAddress is not complete" at all in the response? Commented Sep 8, 2015 at 14:44
  • yes I couldn't see in any part of response..
    – vicky90
    Commented Sep 14, 2015 at 4:43

1 Answer 1

0

I resolved this by changing in API end by sending the error message as JSON response. By default Salesforce shows only default message for respective Status Code.

In my case I'm getting a response with status code as 400 and Salesforce set the status message as "Bad Request". So I changed in my API end to send a JSON response with error message, from that I can show a proper error message in Salesforce.

You must log in to answer this question.

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