1

Could not find a match for URL /ServercCustomRestApi error occur when i am trying to call one Salesforce org custom rest API from another org..

Salesforce Org "A" having Custom REST API

@RestResource(urlMapping='/ServerCustomRestApi/*')
global class ServerResource
{
@HttpGet
  global static string show()
  {           
         return 'This is Server Account method';                
  }
}

Salesforce org "B" having code for calling

HttpRequest request =new HttpRequest(); 
request.setEndPoint('https://ap1.salesforce.com/services/apexrest/ServerCustomRestApi');   
request.setMethod('GET'); 
request.setHeader('Authorization','OAuth '+AccessToken);
Http htp = new Http();
HTTPResponse res = htp.send(request);
Response =  res.getBody(); 

but after running this code i am getting this error

[{"errorCode":"NOT_FOUND","message":"Could not find a match for URL /ServerCustomRestApi"}]

  • 1
    You quote three different names in your question: ServerCustomRestApi, RestCustomRestApi and ServerRestApi. Start by checking that you are using the same name in the called and calling code. – Keith C May 17 '15 at 11:16
0

Thanks Keith C, i have make it correct..... actually it was incorrect here not on my console.

and i also found the issue:

actually i am using package name as MyPackageAC at the server account ... that's why error occur. change the end point: request.setEndPoint('https://ap1.salesforce.com/services/apexrest/MyPackageAC/ServerCustomRestApi');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.