public bool ReferenceIDIsValid(string refID) { const string apiBaseUrl = "https://api.ubiquity.co.nz"; var url = string.Format("{0}/database/contacts/{1}?format=json&apiToken={2}", apiBaseUrl, refID, APIToken); try { Http.Get(url); return(true); } catch { // Will throw an exception when the refID couldn't be found } return(false); }
public List <dynamic> GetEngageContacts() { var engageContacts = new List <dynamic>(); const string apiBaseUrl = "https://api.ubiquity.co.nz"; var url = string.Format("{0}/database/contacts?format=json&apiToken={1}", apiBaseUrl, APIToken); var json = Http.Get(url); dynamic obj = JsonHelper.Parse(json); // Load all contacts from Engage while (obj.totalReturned > 0) { foreach (var selectedContact in obj.selectedContacts) { engageContacts.Add(selectedContact); } json = Http.Get(url + "&skip=" + obj.next); obj = JsonHelper.Parse(json); } return(engageContacts); }