So I've been trying to get Customer activities from Acumatica using the API endpoint. I try pulling the info down from the following:
- customer->contacts-> Activities
- employee->contact->Activities
- contact->Activities(could not get this one to work)
Contact?$expand=Activities
Can someone please tell me which path I need to take to get Customer Activities from Acumatica API endpoint? Also I do have Activities on my Acumatica instance. I go through debugger to look at content but Activities are blank.
public partial class RestService
{
public async Task<List<Models.AcumaticaCustomerActivities>> GetCustomersActivitiesAsync(int top, string filterOperation, string filter)
{
if (await Login() == false) return null;
List<Models.AcumaticaCustomerActivities> customersActivites;
//string url = settings.url + settings.endpoint + "Customer?$expand=Contacts,Contacts/Contact, Contacts/Contact/Activities";
//string url = settings.url + settings.endpoint + "Employee?$expand=Contact/Activities";
//string url = settings.url + settings.endpoint + "Contact?$expand=Activities";
var uri = new Uri(url); //?$filter=Location eq 'MAIN'&$top=10");
try
{
var response = await client.GetAsync(uri);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
customersActivites = JsonConvert.DeserializeObject<List<Models.AcumaticaCustomerActivities>>(content);
}
else
{
err = await response.Content.ReadAsStringAsync();
try
{
ResponseMessage msg = JsonConvert.DeserializeObject<ResponseMessage>(err);
if (msg != null && msg.exceptionMessage != "") err = msg.exceptionMessage;
return null;
}
catch (Exception ex)
{
err = ex.Message;
return null;
}
}
}
catch (Exception ex)
{
Debug.WriteLine(@" ERROR {0}", ex.Message);
err = ex.Message;
return null;
}
return customersActivites;
}
}
}