function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rplrpl 

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.

 

@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource
{

    @HttpGet
    global static Account doGet() 
    {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        //String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
       try
       { 
           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.

Thanks!

Vinita_SFDCVinita_SFDC

Hello,

 

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

 

https://ap1.salesforce.com/services/apexrest/<Name_of_org>/restdemo?name=s