API Add Filter

From IVS Wiki
Revision as of 16:05, 2 July 2026 by IVSWikiBlue (talk | contribs) (Parameters)
Jump to: navigation, search

This API call will add a new filter.

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 type is 'day'
Number of days
'-3' represents 'Last 3 days'
*no -3
weeks *required if filter type is 'weeks'
Number of weeks
'-4' represents 'Last 4 weeks'
*no -4
range *Required if filter 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
JSON Response
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 2",
  "fields":
  {
    "1":{
      "value":"12345"
    }
  },
}

Successful Response

Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.

{
"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
}