API Add Filter
This API call will add a new filter.
Contents
Resource URL
http://valt.example.com/api/v3/filters
Resource Information
| Method | POST |
| Headers | Content-Type:application/json |
| Response Type | JSON |
| Authentication Required | Yes |
Parameters
The JSON body must be properly formatted. All fields and values should be enclosed in double quotes and separated by a colon.
| Field Name | Description | Required | Example | ||
|---|---|---|---|---|---|
| name | Filter Name | yes | Student | ||
| fields | Metadata fields to include in the filter | no | {"1":{"value":"12345"}} | ||
| {fieldid} | no | 7 | |||
| value | Search string to filter field. | no | John Doe | ||
| rooms | Room IDs to include in filter. | no | 208,209 | ||
| authors | Users and User Groups included in filter. | no | {"users": "197,240,252,282","user_groups": "13"} | ||
| users | Comma separate list of user ids to include in filter. | no | 197,240,252,282 | ||
| user_groups | Comma separate list of user group ids to include in filter. | no | 13,17,21 | ||
| date | no | ||||
| type | Date filter type (Valid Values: none, day, weeks, range) | no | day | ||
| days | *Required if filter date type is 'day' Number of days '-3' represents 'Last 3 days' |
*no | -3 | ||
| weeks | *Required if filter date type is 'weeks' Number of weeks '-4' represents 'Last 4 weeks' |
*no | -4 | ||
| range | *Required if filter date type is 'range' Date range for filter in UNIX timestamp |
*no | {"start": "1749859200","end": "1751673600"} | ||
| start | Filter start date | no | 1749859200 | ||
| end | Filter end date | no | 1751673600 | ||
Response
| Code | Reason |
|---|---|
| 200 | Filter Created Successfully |
| 400 | Invalid Request (See Response for Specific Error) |
| 401 | Unauthorized |
| 500 | JSON Body Formatted Incorrectly |
| data | |
|---|---|
| message | Created |
| id | ID number for the new filter. |
Examples
Request
The sample JSON body below is formatted with line breaks and indentation to make it easier to read. This is not required.
https://ivstest1.ad.ipivs.com/api/v3/filters?access_token=e82632d19c523678fea3d1016c6df9e9
{
"name":"API Filter 1",
"fields":
{
"1":{
"value":"12345"
}
},
}
{
"name": "API Filter - Day",
"date": {
"type": "day",
"days": -3
}
}
</nowwiki>
<nowiki>
{
"name": "API Filter - Weeks",
"date": {
"type": "weeks",
"weeks": -2
}
}
</nowwiki>
<nowiki>
{
"name": "API Filter - Date Range",
"date": {
"type": "range",
"range": {
"start": "1749859200",
"end": "1751673600"
}
}
}
</nowwiki>
===Successful Response===
Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.
<nowiki>
{
"data":{
"message": "Created",
"id": 5
}
}
Failure Response
Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.
{
"data":{
"message": "Validation Error",
"fields":[
{
"name": "name",
"message": "This value should not be blank."
}
]
},
"code": 400
}