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"}]
Best Answer
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');