[Bps-public-commit] rt-extension-rest2 branch, fix-rest2-doc-examples, created. 1.09-2-gdc68247

Steve Burr steve at bestpractical.com
Fri Nov 6 10:59:45 EST 2020


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

- Log -----------------------------------------------------------------
commit 67d35c8ee3d849e2bf399137a184c959f716ac9b
Author: Steven Burr <steve at bestpractical.com>
Date:   Fri Nov 6 10:46:34 2020 -0500

    Fix MimeType in REST2 doc example
    
    The "Comment on a ticket with custom field update" example
    sends a ContentType header of text/plain, but the payload
    is JSON, so it should be application/json.

diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index 30be01b..66b4129 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -495,7 +495,7 @@ Below are some examples using the endpoints above.
         'https://myrt.com/REST/2.0/ticket/6/comment'
 
     # Comment on a ticket with custom field update
-    curl -X POST -H "Content-Type: text/plain" -u 'root:password'
+    curl -X POST -H "Content-Type: application/json" -u 'root:password'
         -d '{ "Content": "Testing a comment", "ContentType": "text/plain", "CustomFields": {"Severity": "High"} }'
         'https://myrt.com/REST/2.0/ticket/6/comment'
 

commit dc68247eed73009c6c64bd39d77a7c53a814ab09
Author: Steven Burr <steve at bestpractical.com>
Date:   Fri Nov 6 10:51:54 2020 -0500

    Move asset examples to their own section in docs
    
    The "Ticket Examples" section had some examples of using
    the assets endpoints. They should be in their own "Asset
    Examples" section.

diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index 66b4129..1fcf6fd 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -499,16 +499,6 @@ Below are some examples using the endpoints above.
         -d '{ "Content": "Testing a comment", "ContentType": "text/plain", "CustomFields": {"Severity": "High"} }'
         '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>
@@ -593,6 +583,20 @@ Below are some examples using the endpoints above.
     GET /asset/:id/history
         retrieve list of transactions for asset
 
+=head3 Assets Examples
+
+Below are some examples using the endpoints above.
+
+    # 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 Catalogs
 
     GET /catalogs/all

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


More information about the Bps-public-commit mailing list