Created
February 10, 2018 18:13
-
-
Save Frelseren/5539e5f012514d874a54b98c499348e3 to your computer and use it in GitHub Desktop.
AngularPOC Apex class REST
This file contains hidden or 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
@RestResource(urlMapping = '/angularpoc') | |
global class AngularPOC { | |
@HttpGet | |
global static List<Contact> getContacts() { | |
RestRequest req = RestContext.request; | |
String contactId = req.params.get('contactId'); | |
if (contactId != null) { | |
return [SELECT Id, Name, Title, Phone, Email FROM Contact WHERE Id =: contactId]; | |
} | |
return [SELECT Id, Name FROM Contact]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment