[Bps-public-commit] rt-extension-rest2 branch, master, updated. 1.06-22-g06e180d

Jim Brandt jbrandt at bestpractical.com
Fri May 24 16:08:15 EDT 2019


The branch, master has been updated
       via  06e180d722fbe19a2725e4a3fdac20b49ba90a90 (commit)
       via  dcc842afe7a79d981abf95b65adc34b70a14bb2c (commit)
       via  da38e3349532bff6b7d285eec08b54ee115a943e (commit)
       via  18a9d56ebc36abb40b433e49ae76eedfd79606f0 (commit)
       via  4f7e086429ea94cc904c81f4521eef2f481a0563 (commit)
       via  daad7cd9d02368dfcc4d847d38f4d59f988b6eec (commit)
       via  785266122b5c39c495c4c9caf8cd0f933b61cfa9 (commit)
       via  aab7cf97c4997bb53b33242164a3365ad2fbb734 (commit)
       via  5dc3e3150281fa8ab7793f892601649f7149245c (commit)
       via  7f25f77baa2c979c1c186a66c93438ac58483d7f (commit)
      from  b342063525fa25bf3d479680651d7833cf91901f (commit)

Summary of changes:
 Changes                                            |  9 ++
 META.yml                                           |  2 +-
 README                                             | 52 ++++++++++++
 lib/RT/Extension/REST2.pm                          | 55 +++++++++++-
 lib/RT/Extension/REST2/Resource.pm                 | 35 ++++++++
 lib/RT/Extension/REST2/Resource/Collection.pm      | 15 +++-
 lib/RT/Extension/REST2/Resource/Record/Readable.pm | 16 ++++
 lib/RT/Extension/REST2/Util.pm                     |  1 +
 xt/queues.t                                        | 67 ++++++++++++++-
 xt/tickets.t                                       | 97 ++++++++++++++++++++++
 10 files changed, 343 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit dcc842afe7a79d981abf95b65adc34b70a14bb2c
Merge: b342063 da38e33
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 24 15:51:04 2019 -0400

    Merge branch 'request-fields'


commit 06e180d722fbe19a2725e4a3fdac20b49ba90a90
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 24 16:08:09 2019 -0400

    Prep for 1.07

diff --git a/Changes b/Changes
index 65fe0e1..c756d8c 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,14 @@
 Revision history for RT-Extension-REST2
 
+1.07 2019-05-24
+ - Accept 'Content' as a parameter on create. The documentation previously showed
+   this in examples, but it wasn't yet supported. Now it works as documented.
+ - Remove To and From from Create examples. These were documentation bugs since
+   they were not supported via the API. Roles can be set using Requestor, Cc, etc.
+ - Reorganize tests for improved development workflow and to avoid spurious
+   failures on install.
+ - Add syntax for requesting specific fields when fetching data (Thanks Andrew Ruthven (puck)!)
+
 1.06 2019-04-03
  - Add orderby and order support to JSON/TicketSQL searches(Thanks gibus!)
 
diff --git a/META.yml b/META.yml
index bc77764..65f84bc 100644
--- a/META.yml
+++ b/META.yml
@@ -43,6 +43,6 @@ requires:
   perl: 5.10.1
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: '1.06'
+version: '1.07'
 x_module_install_rtx_version: '0.40'
 x_requires_rt: 4.2.4
diff --git a/README b/README
index 7029a21..40138e3 100644
--- a/README
+++ b/README
@@ -565,6 +565,58 @@ USAGE
     items, but it may be increased up to 100 (or decreased if desired). Page
     numbers start at 1.
 
+  Fields
+    When fetching search results you can include additional fields by adding
+    a query parameter fields which is a comma seperated list of fields to
+    include. You must use the camel case version of the name as included in
+    the results for the actual item.
+
+    You can use additional fields parameters to expand child blocks, for
+    example (line wrapping inserted for readability):
+
+        XX_RT_URL_XX/REST/2.0/tickets
+          ?fields=Owner,Status,Created,Subject,Queue
+          &fields[Queue]=Name,Description
+
+    Says that in the result set for tickets, the extra fields for Owner,
+    Status, Created, Subject and Queue should be included. But in addition,
+    for the Queue block, also include Name and Description. The results
+    would be similar to this (only one ticket is displayed):
+
+       "items" : [
+          {
+             "Subject" : "Sample Ticket",
+             "id" : "2",
+             "type" : "ticket",
+             "Owner" : {
+                "id" : "root",
+                "_url" : "XX_RT_URL_XX/REST/2.0/user/root",
+                "type" : "user"
+             },
+             "_url" : "XX_RT_URL_XX/REST/2.0/ticket/2",
+             "Status" : "resolved",
+             "Created" : "2018-06-29:10:25Z",
+             "Queue" : {
+                "id" : "1",
+                "type" : "queue",
+                "Name" : "General",
+                "Description" : "The default queue",
+                "_url" : "XX_RT_URL_XX/REST/2.0/queue/1"
+             }
+          }
+          { … },
+          …
+       ],
+
+    If the user performing the query doesn't have rights to view the record
+    (or sub record), then the empty string will be returned.
+
+    For single object URLs like /ticket/:id, as it already contains all the
+    fields by default, parameter "fields" is not needed, but you can still
+    use additional fields parameters to expand child blocks:
+
+        XX_RT_URL_XX/REST/2.0/ticket/1?fields[Queue]=Name,Description
+
   Authentication Methods
     Authentication should always be done over HTTPS/SSL for security. You
     should only serve up the /REST/2.0/ endpoint over SSL.
diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index c3bfeee..c4b61c6 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -4,7 +4,7 @@ use 5.010001;
 
 package RT::Extension::REST2;
 
-our $VERSION = '1.06';
+our $VERSION = '1.07';
 our $REST_PATH = '/REST/2.0';
 
 use Plack::Builder;

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list