-
-
Save TheShubhamVsnv/3cf849544d48c975c82163454a3b39c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@HttpDelete | |
global static string deleteContact() { | |
// Retrieving the incoming REST request | |
RestRequest req = RestContext.request; | |
// Extracting the contact Id from the request URI | |
String contactId = req.requestURI.substring(req.requestURI.lastindexof('/') + 1); | |
// Querying for the contact record to be deleted | |
Contact contact = [SELECT Id FROM Contact WHERE id = :contactId LIMIT 1]; | |
// Deleting the contact record | |
delete contact; | |
// Returning a success message | |
return 'Success Deletion'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment