[Bps-public-commit] rt-extension-rest2 branch, rest2-doc-examples, repushed

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


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 <craig at bestpractical.com>
     
    -    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=<JSON>
     @@
          GET /asset/:id/history
              retrieve list of transactions for asset
2:  ef3f0df ! 3:  5d76e5c User doc examples
    @@ -1,6 +1,39 @@
     Author: craig Kaiser <craig at bestpractical.com>
     
         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=<JSON>
    +         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 <craig at bestpractical.com>
     
         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=<JSON>
    +         POST /assets
     
     diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
     --- a/lib/RT/Extension/REST2.pm



More information about the Bps-public-commit mailing list