3

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

4

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

3
  • 1
    Thank you Mohith. That indeed was the issue. Commented Sep 28, 2021 at 11:13
  • the namespace in your uri should be case-sensitive Commented May 23, 2022 at 20:28
  • Thanks Mohith, helped me in 2023 :)
    – Arjee
    Commented Dec 7, 2023 at 15:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .