+ Start a Discussion

Salesforce REST API Mock Response

I just need to provide mock responses for the all the REST API's I'm developing and I'll be sendingmock=true in the request parameter. If mock=true, then it should bypass the logic in apex code and just send the response. what is the best way to achieve this?

What I'm doing right now is, I'm just looking for the mock parameter and if true, sending the response back. So I'm storing the dummy JSON in a variable to send it back. Is there any other approach?
Best Answer chosen by kpn
Check this: https://developer.salesforce.com/blogs/developer-relations/2013/03/testing-apex-callouts-using-httpcalloutmock.html