10 Antworten
Please check below post for step by step process with screen shot.1) http://amitsalesforce.blogspot.com/2016/04/rest-api-in-salesforce-execute-rest-api.html Do minar change your code like below :-
@RestResource(urlMapping='/Account/Contacts/*')
global with sharing class AccountManager
{
@HttpGet
global static Account getAccount()
{
RestRequest request = RestContext.request;
String AccountId= request.requestURI.substring( request.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Id,Name FROM Account WHERE Id = :AccountId];
return result;
}
}
I just added * in your URL
Your URL should be :- /services/apexrest/Account/Contacts/<AccountID>Method :- GetLey us know if this will help youThanksAmit Chaudhary