[Rt-commit] rt branch, fix-rest2-doc-examples, created. rt-5.0.0-54-g3ac05d7baf

Steve Burr steve at bestpractical.com
Fri Nov 6 11:00:25 EST 2020


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

- Log -----------------------------------------------------------------
commit 255abfc8bb01bf887afc5d3cd386c88513d13c45
Author: Steven Burr <steve at bestpractical.com>
Date:   Fri Nov 6 10:56:54 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/REST2.pm b/lib/RT/REST2.pm
index 1079f95cd6..f23cea7db1 100644
--- a/lib/RT/REST2.pm
+++ b/lib/RT/REST2.pm
@@ -516,7 +516,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 3ac05d7baf08f7172b21dc090032c397a3643a05
Author: Steven Burr <steve at bestpractical.com>
Date:   Fri Nov 6 10:59:03 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/REST2.pm b/lib/RT/REST2.pm
index f23cea7db1..5cb5ee2f9e 100644
--- a/lib/RT/REST2.pm
+++ b/lib/RT/REST2.pm
@@ -520,16 +520,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>
@@ -614,6 +604,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 rt-commit mailing list