Verifying your extender
To aid in the creation of extenders, an extender expression can be tested against specific objects, by calling the Objective Extender Service validateexpression
end point. This can allow you to test the extender expression syntax before committing it to an actual extender.
POST /extender-api/validateexpression
{
"expressionType": 0,
"expression" : "${name}",
"objectIds": ["fA0", "A1"]
}
The above example evaluates the given expression "${name}" against the fA0 folder and A1 document objects.
[
{
"id": "fA0",
"result": "Objective Global Folder",
"valid": true
},
{
"id": "A1"
"result": "Test Document",
"valid": true
}
]
If the "valid"
property is true, then the expression is syntactically correct. The "result"
property displays the value of the evaluated expression for the given object id.
The validateexpression
end point can also be used to test a metadata filter expression by setting the expressionType
to 2.
POST /extender-api/validateexpression
{
"expressionType": 2,
"expression" : "${state} == \"DRAFT\"",
"objectIds": ["A1", "A2"]
}
The above example evaluates the given expression "${state} == \"DRAFT\"" against the A1 and A2 document objects.
[
{
"id": "A1",
"result": "true",
"valid": true
},
{
"id": "A2",
"result": "false",
"valid": true
}
]
If the "valid"
property is true, then the expression is syntactically correct. The "result"
property displays the value of the evaluated expression for the given object id.
The following table describes the Json input format when calling validateexpression
:
Parameter name |
Type |
Required / Optional |
Description |
---|---|---|---|
expressionType |
number |
required |
0 - returns a string as the result. 1 - returns an URL encoded string as the result. 2 - returns a Boolean value as the result. |
expression |
string |
required |
Expression to evaluate. |
objectIds |
array of strings |
required |
List of object IDs to test. |