[Bps-public-commit] rt-extension-rest2 05/05: Add an example for bulk correspond

Jim Brandt jbrandt at bestpractical.com
Fri Jul 16 19:39:50 UTC 2021


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

jbrandt pushed a commit to branch tickets-bulk-message
in repository rt-extension-rest2.

commit 98a832c56a0cb170a69b4ba0485e89e5a41f39f8
Author: Jim Brandt <jbrandt at bestpractical.com>
AuthorDate: Fri Jul 16 15:07:22 2021 -0400

    Add an example for bulk correspond
---
 README                    | 13 +++++++++++++
 lib/RT/Extension/REST2.pm |  9 +++++++++
 2 files changed, 22 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 f98f786..99a8a05 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -539,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