I am trying to create REST API using apex class in Salesforce. I am following the Link to create REST API. I want to make it public so that we can access this from anywhere only by hitting the URL like: https://myInstance.com/services/apexrest/MyClassURLMappingName.
But it gives me error of authorization or URL not found/URL not correct etc.
Now my question is: How can I get authenticated with Salesforce Instance without giving User name and password?
For this, i think I have to create a connected application. But it required callback URL, (I am confuse about it. What it should be?).
After creating connected app, we have client ID, client Secret. Now what is the code that I need to write in apex class to make REST API link accessible publicly, but without Force.com Sites.
Please help me out with some code or some exact steps. I have create a simple class with some debug statements and I just want to get them in debug logs, to check if my API is working fine? It is authenticating automatically with Salesforce instance or not.
Any help will be appreciated.