View.AddCriteria
  • 14 May 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

View.AddCriteria

  • Dark
    Light
  • PDF

Article summary

Description

Adds a criteria item to a view.

URL parameters

URL parameter ordering

The URL parameters below are listed in the order they should be entered in the API URL.

NameRequiredTypeDescription
ViewIDTruenumericUnique identifier of the view.
OperatorTruestringContains, Equals, EndsWith, DoesNotContain, etc. See valid operators below.
FieldNameTruestringName of the field the criteria is applied to.
ValueTruestringValue for the criteria. Value is not required for some operators, such as Is After Today and Is Empty.
AndOrFalsestringValid options are And, Or, and None. Default is None .

Responses

NameTypeDescription
ResultstringSuccess if the operation was successful.

Sample request

curl -X GET 'https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&Service=Mozenda10&Operation=View.AddCriteria&ViewID=1103&Operator=Contains&FieldName=Price&Value=2'

Sample responses

XML

<?xml version="1.0" encoding="utf-8" ?>
<ApiResponse 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<Result>Success</Result>
</ApiResponse>

JSON

{
    "JsonResult": {
        "Command": "View.AddCriteria",
        "AutoLoggedIn": false,
        "WebConsoleKey": "",
        "Result": "Success",
        "ErrorCode": "",
        "ErrorDescription": "",
        "ErrorList": [],
        "ExecutionTime": {
            "Ticks": 0,
            "Days": 0,
            "Hours": 0,
            "Milliseconds": 0,
            "Minutes": 0,
            "Seconds": 0,
            "TotalDays": 0,
            "TotalHours": 0,
            "TotalMilliseconds": 0,
            "TotalMinutes": 0,
            "TotalSeconds": 0
        }
    }
}

Valid Operators by Field Type

Text Field
Equals
DoesNotEqual
Contains
DoesNotContain
IsEmpty
IsNotEmpty
BeginsWith
DoesNot BeginWith
EndsWith
DoesNotEndWith

DateTime Field
Equals
DoesNotEqual
IsToday
IsAfter
IsAfterNow
IsAfterToday
IsBefore
IsBeforeNow
IsBeforeToday
IsEmpty
IsNotEmpty

Number Field
Equals
DoesNotEqual
IsGreaterThan
IsLessThan
IsGreaterThanOrEqual
IsLessThanOrEqual
IsEmpty
IsNotEmpty


Was this article helpful?