[Rt-commit] rt branch, 5.0/rest2-query-by-json-support-custom-fields, updated. rt-5.0.1-18-gd85194c13f
Craig Kaiser
craig at bestpractical.com
Fri Mar 5 08:38:14 EST 2021
The branch, 5.0/rest2-query-by-json-support-custom-fields has been updated
via d85194c13f7b2cf6f816293676da0dcff606c467 (commit)
from 0a301a7ddc17905947c63ec071cd46377f9970ed (commit)
Summary of changes:
lib/RT/REST2.pm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
- Log -----------------------------------------------------------------
commit d85194c13f7b2cf6f816293676da0dcff606c467
Author: craig kaiser <craig at bestpractical.com>
Date: Fri Mar 5 08:33:02 2021 -0500
Add documentation for REST2 custom field JSON queries
diff --git a/lib/RT/REST2.pm b/lib/RT/REST2.pm
index 2ea9fb3201..f9ee13de72 100644
--- a/lib/RT/REST2.pm
+++ b/lib/RT/REST2.pm
@@ -675,6 +675,11 @@ Below are some examples using the endpoints above.
-d '[{ "field" : "id", "operator" : ">=", "value" : 0 }]'
'https://myrt.com/REST/2.0/assets'
+ # Search Assets Based On Custom Field Values
+ curl -X POST -H "Content-Type: application/json" -u 'root:password'
+ -d '[{ "field" : "CustomField.{Department}", "value" : "Engineering" }]'
+ 'https://myrt.com/REST/2.0/assets'
+
=head3 Catalogs
GET /catalogs/all
@@ -925,6 +930,18 @@ values). An example:
The JSON payload must be an array of hashes with the keys C<field> and C<value>
and optionally C<operator>.
+
+If the field you're searching against is a Custom Field and not a core field for
+the objects you're searching on, then you use the C<CustomField.{some CF}> syntax:
+
+ curl -si -u user:pass https://rt.example.com/REST/2.0/users -XPOST --data-binary '
+ [
+ { "field" : "CustomField.{Department}",
+ "operator" : "=",
+ "value" : "Human Resources" },
+ ]
+ '
+
Results can be sorted by using multiple query parameter arguments
C<orderby> and C<order>. Each C<orderby> query parameter specify a field
to be used for sorting results. If the request includes more than one
-----------------------------------------------------------------------
More information about the rt-commit
mailing list