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

Craig Kaiser craig at bestpractical.com
Thu Mar 29 12:56:41 EDT 2018


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

- Log -----------------------------------------------------------------
commit c36f58c6c5d6233ab597dd384623b9ad740cf6c5
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 10:19:27 2018 -0400

    Asset doc examples

diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index edee4fc..2c73a15 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -316,16 +316,6 @@ Below are some examples using the endpoints above.
         -d 'Testing a comment'
         'https://myrt.com/REST/2.0/ticket/6/comment'
 
-    # Create an Asset
-    curl -X POST -H "Content-Type: application/json" -u 'root:password'
-        -d '{"Name" : "Asset From Rest", "Catalog" : "General assets", "Content" : "Some content"}'
-        '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/asset'
-
 =head3 Transactions
 
     GET /transactions?query=<JSON>
@@ -405,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 ef3f0dff8b77ceaf6c49f52fd6cf36f66f3168d8
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 10:19:50 2018 -0400

    User doc examples

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 90144a38c9b4c5bba07f66b1cf4f32926724f774
Author: craig Kaiser <craig at bestpractical.com>
Date:   Thu Mar 29 12:54:51 2018 -0400

    Queue doc examples

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