• Charles Fineman
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I have created apex rest service and  I am calling it from workbench rest explorer,but I am getting an error
Created the following class 
@RestResource(urlMapping='/Account/Contacts')
global with sharing class AccountManager{
  @HttpGet
   global static Account getAccount(){
      RestRequest request = RestContext.request;
      // grab the caseId from the end of the URL
        String AccountId= request.requestURI.substring(
          request.requestURI.lastIndexOf('/')+1);
        /*Account result =  [SELECT Id,Name,(Select Name from Contacts) FROM Account
                        WHERE Id = :AccountId];  */
          Account result =  [SELECT Id,Name FROM Account WHERE Id = :AccountId];               
        return result;

   }
 
}

And then when

I am giving the url as /services/apexrest//Account/Contacts/<AccountID>
Error is: Service not found at: /services/apexrest/Account/Contacts/001......

Can some body please help me,why is this error or  with the steps to followed..

Thanks in Advance... 
  • April 13, 2016
  • Like
  • 0