[Bps-public-commit] rt-extension-rest2 01/03: Document /tickets/bulk/correspond and /tickets/bulk/comment endpoints

sunnavy sunnavy at bestpractical.com
Mon Jul 19 18:18:49 UTC 2021


This is an automated email from the git hooks/post-receive script.

sunnavy pushed a commit to branch master
in repository rt-extension-rest2.

commit e50c2310c557aec02e9898d3601c242d3d6040b0
Author: sunnavy <sunnavy at bestpractical.com>
AuthorDate: Fri Jun 18 03:22:37 2021 +0800

    Document /tickets/bulk/correspond and /tickets/bulk/comment endpoints
---
 README                    | 13 +++++++++++++
 lib/RT/Extension/REST2.pm | 13 +++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/README b/README
index 1cfa243..710adb9 100644
--- a/README
+++ b/README
@@ -439,6 +439,10 @@ USAGE
         PUT /tickets/bulk
             update multiple tickets' metadata; provide JSON content(array of hashes)
 
+        POST /tickets/bulk/correspond
+        POST /tickets/bulk/comment
+            add a reply or comment to multiple tickets; provide JSON content(array of hashes)
+
    Ticket Examples
     Below are some examples using the endpoints above.
 
@@ -481,6 +485,15 @@ USAGE
             -d '{ "Content": "Testing a comment", "ContentType": "text/plain", "CustomRoles": {"Manager": "manager at example.com"} }'
             'https://myrt.com/REST/2.0/ticket/6/comment'
 
+        # Update many tickets at once with bulk by sending an array with ticket ids
+        # Results are returned for each update in a JSON array with ticket ids and corresponding messages
+        curl -X POST -H "Content-Type: application/json" -u 'root:password'
+            -d '[{ "id": "20", "Content": "Testing a correspondence", "ContentType": "text/plain" },
+                 { "id": "18", "Content": "Testing a correspondence", "ContentType": "text/plain", "Status":"resolved", "CustomRoles": {"Manager": "manager at example.com"}, "CustomFields": {"State": "New York"} }]'
+            'https://myrt.com/REST/2.0/tickets/bulk/correspond'
+
+        [["20","Correspondence added"],["18","Correspondence added","State New York added","Added manager at example.com as Manager for this ticket","Status changed from 'open' to 'resolved'"]]
+
    Transactions
         GET /transactions?query=<JSON>
         POST /transactions
diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index fdf5d66..99a8a05 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -492,6 +492,10 @@ curl for SSL like --cacert.
     PUT /tickets/bulk
         update multiple tickets' metadata; provide JSON content(array of hashes)
 
+    POST /tickets/bulk/correspond
+    POST /tickets/bulk/comment
+        add a reply or comment to multiple tickets; provide JSON content(array of hashes)
+
 =head3 Ticket Examples
 
 Below are some examples using the endpoints above.
@@ -535,6 +539,15 @@ Below are some examples using the endpoints above.
         -d '{ "Content": "Testing a comment", "ContentType": "text/plain", "CustomRoles": {"Manager": "manager at example.com"} }'
         'https://myrt.com/REST/2.0/ticket/6/comment'
 
+    # Update many tickets at once with bulk by sending an array with ticket ids
+    # Results are returned for each update in a JSON array with ticket ids and corresponding messages
+    curl -X POST -H "Content-Type: application/json" -u 'root:password'
+        -d '[{ "id": "20", "Content": "Testing a correspondence", "ContentType": "text/plain" },
+             { "id": "18", "Content": "Testing a correspondence", "ContentType": "text/plain", "Status":"resolved", "CustomRoles": {"Manager": "manager at example.com"}, "CustomFields": {"State": "New York"} }]'
+        'https://myrt.com/REST/2.0/tickets/bulk/correspond'
+
+    [["20","Correspondence added"],["18","Correspondence added","State New York added","Added manager at example.com as Manager for this ticket","Status changed from 'open' to 'resolved'"]]
+
 =head3 Transactions
 
     GET /transactions?query=<JSON>

-- 
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.


More information about the Bps-public-commit mailing list