I am new to apex rest . I am trying to expose an apex class to an external system to do post operation in salesforce. I am a bit confused with the response codes and response message which I need to send back to external system. I was referring to this link https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_restresponse.htm#apex_System_RestResponse_statusCode . This gives some standard error codes. I have couple of questions.
- Do I need to write some custom logic in my apex rest class to send back the response code or salesforce will automatically determine which response code and message needs to be sent back in response?
- Can I also send back any custom response code and message as well . If yes, how to do that? Any sample code would be helpful