You need to sign in to do that
Don't have an account?
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!
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