i have an odata endpoint something like this.
object is like this
public class Propertey
{
public string Key { get; set; }
public string Value { get; set; }
}
public class MonitoringEvent : DocumentEntity
{
public string AppName { get; set; }
public string Service { get; set; }
public string Fuction { get; set; }
public string CorrelationId { get; set; }
public List<Propertey> Properties { get; set; }
public string EventName { get; set; }
public DateTime TimeStamp { get; set; } = DateTime.UtcNow;
}
i want to be able to return all the items that has properties with key = "abc"
i was using something like
localhost:7071/monitoringEvents?$filter=properties/key eq 'abc'
but it doesn't work. is there a solution to it or
what if i change properties to type IDictionary ? what should be the query url like ?
Update also tried
localhost:7071/monitoringEvents?$filter=properties(key) eq 'abc' and localhost:7071/monitoringEvents?$expand=properties($filter=key eq 'abc')
didn't worked either
any
can meet your requirement.
Checkout the following example:
~/monitoringEvents?$filter=Properties/any(p:p/Key eq 'abc')