Get Filtered Records
Review data filtered by an existing View filter by using the GetFilteredData endpoint.
| Description | Returns data that has been filtered by an existing View filter |
|---|---|
| URL | /board/[boardname]/display/[displayviewname] |
| Method | POST |
| Parameters |
|
Review the parameter definitions and examples of how to use the GetFilteredData endpoint in JavaScript and C# calls.
Parameters
| Variable Name | Type | Description | Required |
|---|---|---|---|
| boardname | String | Name of the board that contains the records you want to retrieve | True (URL) |
| displayviewname | String | Name of the view that displays the records you want to retrieve | True (URL) |
Allowed Filter Operations
-
Equal
-
LessThan
-
GreaterThan
-
LessThanOrEqual
-
GreaterThanOrEqual
-
Like
-
Intersects
-
NotEqual
Examples
JavaScript Call
Copy Code
var filteredDataObject = { viewFilters: ["RoadName"],
// "RoadName" would refer to an existing viewfilter.
customFilter: {
// The customFilter represents a viewfilter
// created as part of the REST request.
boolean: 'or',
items: [
{
fieldname: 'region',
operator: 'Like',
fieldvalue: 'A%'
},
{
fieldname: 'region',
operator: '=',
fieldvalue: 'Columbia'
},
{
fieldname: 'location', operator: 'Intersects', fieldvalue: `POLYGON ((
-84.16341278901578 34.059674236869469,
-84.161955300724216 34.073452400898347,
-84.196549213997429 34.070079088483865,
-84.187118407404981 34.060668612371458,
-84.16341278901578 34.059674236869469
))`
}
]
}
};
await fetch(`${baseUrl}/board/Road Closures/display/List`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(filteredDataObject)
})
C# Call
Copy Code
public async Task<string> GetFilteredData()
{
using (var httpClient = new HttpClient(httpClientHandler))
{
var filteredDataObject = new
{
viewFilters = new string[] { "RoadName" },
customFilter = new
{
boolean = "or",
items = new object[] {
new {
'operator' in C#
fieldname="region",
fieldvalue="A%",
@operator="like"
}, // The "at sign" is necessary when naming a variable 'operator' in C#
new {
fieldname="region",
fieldvalue="Columbia",
@operator="="
},
new { fieldname="location",
fieldvalue=@" POLYGON ((
-84.16341278901578 34.059674236869469,
-84.161955300724216 34.073452400898347,
-84.196549213997429 34.070079088483865,
-84.187118407404981 34.060668612371458,
-84.16341278901578 34.059674236869469
))",
@operator="Intersects"
}
}
}
};
var serializedInformation = JsonConvert.SerializeObject(filteredDataObject);
var response = await httpClient.PostAsync($"{baseUrl}/board/Road Closures/display/List",
new StringContent(serializedInformation, Encoding.UTF8, "application/json"));
return await response.Content.ReadAsStringAsync();
}
}