Skip to content

Instantly share code, notes, and snippets.

@Frelseren
Created February 10, 2018 18:13
Show Gist options
  • Save Frelseren/5539e5f012514d874a54b98c499348e3 to your computer and use it in GitHub Desktop.
Save Frelseren/5539e5f012514d874a54b98c499348e3 to your computer and use it in GitHub Desktop.
AngularPOC Apex class REST
@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