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

Craig Kaiser craig at bestpractical.com
Wed Feb 14 13:01:59 EST 2018


The branch rt-extension-rest2-docs was deleted and repushed:
       was 31a3204957be10dfd9f5e155d395c7a1f7a3927b
       now 09d7e3f51a26e2e50df674fb6b5e342f6656ffbf

1:  31a3204 ! 1:  09d7e3f Update REST2 docs with examples and clearer notation
    @@ -20,7 +20,7 @@
     +
     +=head3 GET Examples
     +
    -+If we need to get information on an endpoint quickly, we can use the GET method.
    ++If we need to get information on an endpoints quickly, we can use the GET method.
     +
     +    curl -X GET -u 'root:password' 'REST/2.0/tickets?query=id=1'
     +
    @@ -40,9 +40,12 @@
     +        },
     +    ]}
     +
    ++Query our Group id = 2:
    ++
     +    curl -X GET -u 'root:password' 'REST/2.0/group/2/'
     +
    -+Here we can get the information on a group such as:
    ++Here we can get the information on group 2:
    ++
     +     "Members"
     +        {
     +            "_url" : "http://localhost:8080/REST/2.0/user/RT_System",
    @@ -67,8 +70,7 @@
     +
     +=head3 POST Examples
     +
    -+All the REST2.0 endpoints offer a POST method for creating and querying, some
    -+examples of this can be viewed below.
    ++Use POST method to submit JSON data.
     +
     +Creating a new Asset:
     +
    @@ -79,7 +81,7 @@
     +
     +Result:
     +
    -+{"_url":"/REST/2.0/asset/10","id":"10","type":"asset"}
    ++    {"_url":"/REST/2.0/asset/10","id":"10","type":"asset"}
     +
     +Creating a new User:
     +
    @@ -90,7 +92,7 @@
     +
     +Name is a mandatory field:
     +
    -+{"_url":"http://localhost:8080/REST/2.0/user/TestUser","id":"TestUser","type":"user"}
    ++    {"_url":"http://localhost:8080/REST/2.0/user/TestUser","id":"TestUser","type":"user"}
     +
      =head3 Creating Tickets
      
    @@ -99,12 +101,16 @@
              "id"   : "20"
          }
      
    ++With CustomFields:
    ++
     +    curl -X POST -H "Content-Type: application/json"
    -+        -d '{"Subject": "Ticket Create using REST", "Priority": 42}'
    ++        -d '{"Subject": "Ticket Create using REST", "CustomFields": {"MyCustomField": "value"} }'
     +        -u 'root:password'
     +        '/REST/2.0/ticket?Queue=1'
     +
    -+    {"_url":"/REST/2.0/ticket/68","type":"ticket","id":"1"}
    ++Result:
    ++
    ++    {"_url":"/REST/2.0/ticket/1","type":"ticket","id":"1"}
     +
      (REST2 also produces the status code of C<201 Created> with a C<Location>
      header of the new ticket, which you may choose to use instead of the
    @@ -184,8 +190,12 @@
          POST /customfields
              search for custom fields using L</JSON searches> syntax
      
    -@@
    - 
    +     GET /customfield/:id
    +         retrieve a custom field
    + 
    ++    POST or PUT with CustomFields
    ++        JSON { "CustomFields": {"CustomFieldName": "value", "CustomFieldName": "value"} }
    ++
      =head3 Custom Roles
      
     -    GET /customroles?query=<JSON>



More information about the Bps-public-commit mailing list