I have an existing Apex REST Webservice configured in production for consumption by a partner for Lead creation. However, we are not working with that partner anymore and hence want to disable this Lead creation API for them.

How should I do this? Should I comment out the code of this class(I don't hope so)?

OR should I just delete this Apex class?

  • If you are not working with the partner, you should instead ensure that they don't have access to the system anymore. That will itself take care of disabling any API for them.
    – Jayant Das
    Jun 4 '19 at 17:57
  • 1
    Here's a super-simple example of how to delete a class from production using only the software found on your OS that I wrote a number of years ago. If deletion is what you're looking for, this is perhaps one of the easiest.
    – sfdcfox
    Jun 4 '19 at 18:03
  • 1
    How was your partner authenticating? Was it being done via an OAuth 2.0 flow (if so, which one?) or is your REST endpoint made public via a site/community?
    – Derek F
    Jun 4 '19 at 18:03
  • if the partner had a unique profile or permission set for that apex class, you could remove access to the class on that profile/permission set
    – cropredy
    Jun 5 '19 at 21:09
  • @JayantDas I am looking for a way to disable the API altogether for everyone.
    – srmaind
    Jun 9 '19 at 8:05

To answer my own question, based on the comments by fellow developers/consultants here, I have come to a conclusion to delete the Webservice class altogether from Salesforce.

Refer to @sfdcfox's comment for the example to delete classes from org

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.