2

I have a rest class with a @RestResource annotation and a method with @HttpPost annotation. Something like -

(urlMapping='/abc/contractors')
class ContractorInfoWebService {

    @HttpPost 
    global static void callContractorsInfoService() {
      // some code here........
    }   
}

While creating the class in my development org (in an unmanaged package) I was able to hit the uri /services/apexrest/abc/contractors and get a response out of it. But after the class is deployed to production environment in a managed package, I am getting an error when trying to hit the same uri saying -

Service not found at: /services/apexrest/abc/contractors

The request type and body and everything is correct while trying to access the URI. Could somebody please explain why it was working in my dev org but is failing after being installed through a managed package ? Is there some setting or any addition required in the URI now that it is in a managed pacakge ?

1 Answer 1

2

For a managed package you will need to ensure you provide the namespace of the package when hitting the custom rest endpoint.

Your url to try hitting would be as below

services/apexrest/namespace/abc/contractors

Here note namespace is the actual namespace of your package

2
  • Thank you Mohith. That indeed was the issue. Sep 28, 2021 at 11:13
  • the namespace in your uri should be case-sensitive May 23 at 20:28

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.