[Bps-public-commit] rt-extension-rest2 branch, rest2-doc-examples, created. 1.03-6-ga563618

Craig Kaiser craig at bestpractical.com
Tue Oct 8 09:29:51 EDT 2019


The branch, rest2-doc-examples has been created
        at  a563618f9c1036d0a8c2c16376017406217f513a (commit)

- Log -----------------------------------------------------------------
commit 31bf85363a540d7c167e29c9cbeb199fd69f8bb9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Mar 20 00:33:41 2018 +0800

    Add Correspond/Comment examples

diff --git a/README b/README
index 042cb5c..32087fa 100644
--- a/README
+++ b/README
@@ -267,10 +267,19 @@ USAGE
 
         # Update a ticket, with a custom field update
         curl -X PUT -H "Content-Type: application/json" -u 'root:password'
-            -d '{ "Subject": "Update test", "Content": "Testing an update",
-                "CustomFields": {"Severity": "High"}}'
+            -d '{ "Subject": "Update test", "CustomFields": {"Severity": "High"}}'
             'https://myrt.com/REST/2.0/ticket/6'
 
+        # Correspond a ticket
+        curl -X POST -H "Content-Type: application/json" -u 'root:password'
+            -d '{ "Content": "Testing a correspondence", "ContentType": "text/plain" }'
+            'https://myrt.com/REST/2.0/ticket/6/correspond'
+
+        # Comment a ticket
+        curl -X POST -H "Content-Type: text/plain" -u 'root:password'
+            -d 'Testing a comment'
+            'https://myrt.com/REST/2.0/ticket/6/comment'
+
    Transactions
         GET /transactions?query=<JSON>
         POST /transactions
diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index ebb8809..e720a66 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -306,6 +306,16 @@ Below are some examples using the endpoints above.
         -d '{ "Subject": "Update test", "CustomFields": {"Severity": "High"}}'
         'https://myrt.com/REST/2.0/ticket/6'
 
+    # Correspond a ticket
+    curl -X POST -H "Content-Type: application/json" -u 'root:password'
+        -d '{ "Content": "Testing a correspondence", "ContentType": "text/plain" }'
+        'https://myrt.com/REST/2.0/ticket/6/correspond'
+
+    # Comment a ticket
+    curl -X POST -H "Content-Type: text/plain" -u 'root:password'
+        -d 'Testing a comment'
+        'https://myrt.com/REST/2.0/ticket/6/comment'
+
 =head3 Transactions
 
     GET /transactions?query=<JSON>

commit 417549359760aacc72e2f9bac2d8cb69f11baa9d
Author: craig Kaiser <craig at bestpractical.com>
Date:   Wed Mar 21 14:57:09 2018 -0400

    Add Asset examples

diff --git a/README b/README
index 32087fa..9704de8 100644
--- a/README
+++ b/README
@@ -355,6 +355,29 @@ USAGE
         GET /asset/:id/history
             retrieve list of transactions for asset
 
+   Asset Examples
+    Below are some examples using the enpoints above.
+
+        # Create an Asset
+        curl -X POST -H "Content-Type: application/json" -u 'root:password'
+            -d '{"Name" : "Asset From Rest",
+                "Catalog" : "General assets",
+                "Description" : "Some content",
+                "CustomFields" : {"MyCustomField" : "Value On Create"}
+                }'
+            'https://myrt.com/REST/2.0/asset'
+
+        # Search Assets
+        curl -X POST -H "Content-Type: application/json" -u 'root:password'
+            -d '[{ "field" : "id", "operator" : ">=", "value" : 0 }]'
+            'https://myrt.com/REST/2.0/assets'
+
+        # Update Asset
+        curl -X PUT -H "Content-Type: application/json" -u 'root:password'
+            -d '{"Description": "A new description",
+                "CustomFields" : {"MyCustomField" : "NewValue"}}'
+            'https://myrt.com/REST/2.0/asset/2'
+
    Catalogs
         GET /catalogs/all
             retrieve list of all catalogs you can see
diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index e720a66..2c73a15 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -395,6 +395,30 @@ Below are some examples using the endpoints above.
     GET /asset/:id/history
         retrieve list of transactions for asset
 
+=head3 Asset Examples
+
+Below are some examples using the enpoints above.
+
+    # Create an Asset
+    curl -X POST -H "Content-Type: application/json" -u 'root:password'
+        -d '{"Name" : "Asset From Rest",
+            "Catalog" : "General assets",
+            "Description" : "Some content",
+            "CustomFields" : {"MyCustomField" : "Value On Create"}
+            }'
+        'https://myrt.com/REST/2.0/asset'
+
+    # Search Assets
+    curl -X POST -H "Content-Type: application/json" -u 'root:password'
+        -d '[{ "field" : "id", "operator" : ">=", "value" : 0 }]'
+        'https://myrt.com/REST/2.0/assets'
+
+    # Update Asset
+    curl -X PUT -H "Content-Type: application/json" -u 'root:password'
+        -d '{"Description": "A new description",
+            "CustomFields" : {"MyCustomField" : "NewValue"}}'
+        'https://myrt.com/REST/2.0/asset/2'
+
 =head3 Catalogs
 
     GET /catalogs/all

commit 5d76e5cb8380f92ac70359e8350122ba6c998763
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 10:19:50 2018 -0400

    User doc examples

diff --git a/README b/README
index 9704de8..ffcfc60 100644
--- a/README
+++ b/README
@@ -425,6 +425,28 @@ USAGE
         GET /user/:name/history
             retrieve list of transactions for user
 
+   User examples
+    Below are some examples using the enpoints above.
+
+        # Search
+        curl -X POST -H "Content-Type: application/json"
+            -d '[{"field": "Name", "operator": "LIKE", "value" : "MyUserName"}]'
+            -u 'root:password' 'https://myrt.com/REST/2.0/users'
+
+        # Create
+        curl -X POST -H "Content-Type: application/json"
+            -d '{"Name": "TestUser", "Nickname": "Tester"}'
+            -u 'root:password' 'https://myrt.com/REST/2.0/user'
+
+        # Update
+        curl -X PUT -H "Content-Type: application/json"
+            -d '{"Name": "NewName",  "CustomFields" : {"MyCF" : "NewValue"} }'
+            -u 'root:password' 'https://myrt.com/REST/2.0/user/TestUser'
+
+        # Delete
+        curl -X DELETE -u 'root:password'
+            'http://localhost:8080/REST/2.0/user/MyUser'
+
    Groups
         GET /groups?query=<JSON>
         POST /groups
diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index 2c73a15..7b6d7d0 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -468,6 +468,29 @@ Below are some examples using the enpoints above.
     GET /user/:name/history
         retrieve list of transactions for user
 
+=head3 User examples
+
+Below are some examples using the enpoints above.
+
+    # Search
+    curl -X POST -H "Content-Type: application/json"
+        -d '[{"field": "Name", "operator": "LIKE", "value" : "MyUserName"}]'
+        -u 'root:password' 'https://myrt.com/REST/2.0/users'
+
+    # Create
+    curl -X POST -H "Content-Type: application/json"
+        -d '{"Name": "TestUser", "Nickname": "Tester"}'
+        -u 'root:password' 'https://myrt.com/REST/2.0/user'
+
+    # Update
+    curl -X PUT -H "Content-Type: application/json"
+        -d '{"Name": "NewName",  "CustomFields" : {"MyCF" : "NewValue"} }'
+        -u 'root:password' 'https://myrt.com/REST/2.0/user/TestUser'
+
+    # Delete
+    curl -X DELETE -u 'root:password'
+        'http://localhost:8080/REST/2.0/user/MyUser'
+
 =head3 Groups
 
     GET /groups?query=<JSON>

commit a563618f9c1036d0a8c2c16376017406217f513a
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 12:54:51 2018 -0400

    Queue doc examples

diff --git a/README b/README
index ffcfc60..269699a 100644
--- a/README
+++ b/README
@@ -335,6 +335,28 @@ USAGE
         GET /queue/:name/history
             retrieve list of transactions for queue
 
+   Queue examples
+    Below are some examples using the enpoints above.
+
+        # Create A Queue
+        curl -X POST -H "Content-Type: application/json" -u 'root:password'
+            -d '{"Name" : "NewQueue", "Description" : "A Queue For New Things"}'
+            'https://myrt.com/REST/2.0/queue'
+
+        # Get All Queues
+        curl -X GET -u 'root:password'
+            'https://myrt.com/REST/2.0/queues/all'
+
+        # Search For A Queue
+         curl -X POST -H "Content-Type: application/json" -u 'root:password'
+            -d '[{"field" : "Name", "value" : "General"}]'
+            'https://myrt.com/REST/2.0/queues'
+
+        # Update A Queue
+        curl -X PUT -H "Content-Type: application/json" -u 'root:password'
+            -d '{"Name" : "NewName", "CustomFields" : { "MyCustomField" : "UpdatedValue" } }'
+            'https://myrt.com/REST/2.0/queue/General'
+
    Assets
         GET /assets?query=<JSON>
         POST /assets
diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index 7b6d7d0..0489e18 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -374,6 +374,29 @@ Below are some examples using the endpoints above.
     GET /queue/:name/history
         retrieve list of transactions for queue
 
+=head3 Queue examples
+
+Below are some examples using the enpoints above.
+
+    # Create A Queue
+    curl -X POST -H "Content-Type: application/json" -u 'root:password'
+        -d '{"Name" : "NewQueue", "Description" : "A Queue For New Things"}'
+        'https://myrt.com/REST/2.0/queue'
+
+    # Get All Queues
+    curl -X GET -u 'root:password'
+        'https://myrt.com/REST/2.0/queues/all'
+
+    # Search For A Queue
+     curl -X POST -H "Content-Type: application/json" -u 'root:password'
+        -d '[{"field" : "Name", "value" : "General"}]'
+        'https://myrt.com/REST/2.0/queues'
+
+    # Update A Queue
+    curl -X PUT -H "Content-Type: application/json" -u 'root:password'
+        -d '{"Name" : "NewName", "CustomFields" : { "MyCustomField" : "UpdatedValue" } }'
+        'https://myrt.com/REST/2.0/queue/General'
+
 =head3 Assets
 
     GET /assets?query=<JSON>

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


More information about the Bps-public-commit mailing list