mhoppa commented on a change in pull request #4518: Add service category 
feature to TO and TP
URL: https://github.com/apache/trafficcontrol/pull/4518#discussion_r395132478
 
 

 ##########
 File path: docs/source/api/v2/service_categories.rst
 ##########
 @@ -0,0 +1,156 @@
+..
+..
+.. Licensed under the Apache License, Version 2.0 (the "License");
+.. you may not use this file except in compliance with the License.
+.. You may obtain a copy of the License at
+..
+..     http://www.apache.org/licenses/LICENSE-2.0
+..
+.. Unless required by applicable law or agreed to in writing, software
+.. distributed under the License is distributed on an "AS IS" BASIS,
+.. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+.. See the License for the specific language governing permissions and
+.. limitations under the License.
+..
+
+.. _to-api-service-categories:
+
+************
+``service categories``
+************
+
+
+``GET``
+=======
+Get all requested :term:`Service Categories`.
+
+:Auth. Required: Yes
+:Roles Required: None
+:Response Type:  Array
+
+Request Structure
+-----------------
+.. table:: Request Query Parameters
+
+    
+-----------+---------------------------------------------------------------------------------------------------------------+
+       | Name      | Description                                               
                                                    |
+       
+===========+===============================================================================================================+
+       | id        | Filter for :term:`Service Categories` having this 
integral, unique identifier                                 |
+       
+-----------+---------------------------------------------------------------------------------------------------------------+
+       | name      | Filter for :term:`Service Categories` with this name      
                                                    |
+       
+-----------+---------------------------------------------------------------------------------------------------------------+
+       | orderby   | Choose the ordering of the results - must be the name of 
one of the fields of the objects in the ``response`` |
+       |           | array                                                     
                                                    |
+       
+-----------+---------------------------------------------------------------------------------------------------------------+
+       | sortOrder | Changes the order of sorting. Either ascending (default 
or "asc") or descending ("desc")                      |
+       
+-----------+---------------------------------------------------------------------------------------------------------------+
+       | limit     | Choose the maximum number of results to return            
                                                    |
+       
+-----------+---------------------------------------------------------------------------------------------------------------+
+       | offset    | The number of results to skip before beginning to return 
results. Must use in conjunction with limit          |
+       
+-----------+---------------------------------------------------------------------------------------------------------------+
+       | page      | Return the n\ :sup:`th` page of results, where "n" is the 
value of this parameter, pages are ``limit`` long   |
+       |           | and the first page is 1. If ``offset`` was defined, this 
query parameter has no effect. ``limit`` must be     |
+       |           | defined to make use of ``page``.                          
                                                    |
+       
+-----------+---------------------------------------------------------------------------------------------------------------+
+
+.. code-block:: http
+       :caption: Request Example
+
+       GET /api/2.0/servicecategories?name=SERVICE_CATEGORY_NAME HTTP/1.1
+       Host: trafficops.infra.ciab.test
+       User-Agent: curl/7.47.0
+       Accept: */*
+       Cookie: mojolicious=...
+
+Response Structure
+------------------
+:id:          The integral, unique identifier of this :term:`Service Category`
+:name:        This :term:`Service Category`'s name
+:lastUpdated: The date and time at which this :term:`Service Category` was 
last modified, in ISO format
+
+.. code-block:: http
+       :caption: Response Example
+
+       HTTP/1.1 200 OK
+       Access-Control-Allow-Credentials: true
+       Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, 
Accept, Set-Cookie, Cookie
+       Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
+       Access-Control-Allow-Origin: *
+       Content-Type: application/json
+       Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 
GMT; Max-Age=3600; HttpOnly
+       Whole-Content-Sha512: 
Yzr6TfhxgpZ3pbbrr4TRG4wC3PlnHDDzgs2igtz/1ppLSy2MzugqaGW4y5yzwzl5T3+7q6HWej7GQZt1XIVeZQ==
+       X-Server-Name: traffic_ops_golang/
+       Date: Wed, 11 Mar 2020 20:02:47 GMT
+       Content-Length: 102
+
+{
+    "response": [
+        {
+            "id": 5,
+            "lastUpdated": "2020-03-04 15:46:20-07",
+            "name": "SERVICE_CATEGORY_NAME"
+        }
+    ]
+}
+
+``POST``
+========
+Create a new service category.
+
+:Auth. Required: Yes
+:Roles Required: "admin" or "operations"
+:Response Type:  Object
+
+Request Structure
+-----------------
+:name:  The name of the new service category
+
+.. code-block:: http
+       :caption: Request Example
+
+       POST /api/2.0/servicecategories HTTP/1.1
+       Host: trafficops.infra.ciab.test
+       User-Agent: curl/7.47.0
+       Accept: */*
+       Cookie: mojolicious=...
+       Content-Length: 48
+       Content-Type: application/json
+
+       {
+               "name": "test",
+       }
+
+Response Structure
+------------------
+:id:          An integral, unique identifier for this Service Category
+:lastUpdated: The date and time at which this Service Category was last 
modified, in ISO format
+:name:        The :term:`Service Category` name
+
+.. code-block:: http
+       :caption: Response Example
+
+       HTTP/1.1 200 OK
+       Access-Control-Allow-Credentials: true
+       Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, 
Accept, Set-Cookie, Cookie
+       Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
+       Access-Control-Allow-Origin: *
+       Content-Type: application/json
+       Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 
GMT; Max-Age=3600; HttpOnly
+       Whole-Content-Sha512: 
+pJm4c3O+JTaSXNt+LP+u240Ba/SsvSSDOQ4rDc6hcyZ0FIL+iY/WWrMHhpLulRGKGY88bM4YPCMaxGn3FZ9yQ==
+       X-Server-Name: traffic_ops_golang/
+       Date: Wed, 11 Mar 2020 20:12:20 GMT
+       Content-Length: 154
+
+{
 
 Review comment:
   indented here as well 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to