From craig at bestpractical.com Tue Oct 8 09:29:33 2019 From: craig at bestpractical.com (Craig Kaiser) Date: Tue, 8 Oct 2019 09:29:33 -0400 (EDT) Subject: [Bps-public-commit] rt-extension-rest2 branch, rest2-doc-examples, deleted. 1.03-7-g90144a3 Message-ID: <20191008132934.099AD2418004@booth.bestpractical.com> The branch, rest2-doc-examples has been deleted was 90144a38c9b4c5bba07f66b1cf4f32926724f774 ----------------------------------------------------------------------- 90144a38c9b4c5bba07f66b1cf4f32926724f774 Queue doc examples ----------------------------------------------------------------------- From craig at bestpractical.com Tue Oct 8 09:29:51 2019 From: craig at bestpractical.com (Craig Kaiser) Date: Tue, 8 Oct 2019 09:29:51 -0400 (EDT) Subject: [Bps-public-commit] rt-extension-rest2 branch, rest2-doc-examples, created. 1.03-6-ga563618 Message-ID: <20191008132952.447532418004@booth.bestpractical.com> The branch, rest2-doc-examples has been created at a563618f9c1036d0a8c2c16376017406217f513a (commit) - Log ----------------------------------------------------------------- commit 31bf85363a540d7c167e29c9cbeb199fd69f8bb9 Author: sunnavy 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= 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= commit 417549359760aacc72e2f9bac2d8cb69f11baa9d Author: craig Kaiser 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 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= 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= commit a563618f9c1036d0a8c2c16376017406217f513a Author: craig Kaiser 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= 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= ----------------------------------------------------------------------- From craig at bestpractical.com Tue Oct 8 09:29:53 2019 From: craig at bestpractical.com (Craig Kaiser) Date: Tue, 8 Oct 2019 09:29:53 -0400 (EDT) Subject: [Bps-public-commit] rt-extension-rest2 branch, rest2-doc-examples, repushed Message-ID: <20191008132953.6FC6E2418004@booth.bestpractical.com> The branch rest2-doc-examples was deleted and repushed: was 90144a38c9b4c5bba07f66b1cf4f32926724f774 now a563618f9c1036d0a8c2c16376017406217f513a -: ------- > 1: 31bf853 Add Correspond/Comment examples 1: c36f58c ! 2: 4175493 Add Asset examples @@ -1,27 +1,44 @@ Author: craig Kaiser - Asset doc examples + Add Asset examples + +diff --git a/README b/README +--- a/README ++++ b/README +@@ + 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 --- a/lib/RT/Extension/REST2.pm +++ b/lib/RT/Extension/REST2.pm -@@ - -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= @@ GET /asset/:id/history retrieve list of transactions for asset 2: ef3f0df ! 3: 5d76e5c User doc examples @@ -1,6 +1,39 @@ Author: craig Kaiser User doc examples + +diff --git a/README b/README +--- a/README ++++ b/README +@@ + 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= + POST /groups diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm --- a/lib/RT/Extension/REST2.pm 3: 90144a3 ! 4: a563618 Queue doc examples @@ -1,6 +1,39 @@ Author: craig Kaiser Queue doc examples + +diff --git a/README b/README +--- a/README ++++ b/README +@@ + 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= + POST /assets diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm --- a/lib/RT/Extension/REST2.pm