+ Start a Discussion

creating REST web service: error 404

Need direction : to create a web service that will return the list of products from salesforce and then use this service as a public service in an iOS app.


Below is a dummy rest service i wrote just to test if salesforce returns data when a request is made. But it throws a 404 error.


global with sharing class MyRestResource

    global static Account doGet() 
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        //String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
           Account result = [SELECT Id, Name, Phone, Website FROM Account limit 1];
           return result;
       catch (exception e)
           return null;


i am a fresher andd very new to web services. making a web service in salesforce with OAuth involved is becoming very confusing for me.


Any help would be highly appreciated.





Please check if your Org has any name space. If yes, then include it while requesting. Ex: