You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/03/30 17:31:11 UTC

[GitHub] DylanVolz commented on issue #2029: Implements https://github.com/apache/incubator-trafficcontrol/issues/���

DylanVolz commented on issue #2029: Implements https://github.com/apache/incubator-trafficcontrol/issues/…
URL: https://github.com/apache/incubator-trafficcontrol/pull/2029#issuecomment-377577161
 
 
   After looking over how this endpoint can be written and go, and our plan for api design moving forward (https://cwiki.apache.org/confluence/display/TC/API+Guidelines) I would suggest a few changes:
   
   Change the route to not be nested. We are moving away from nested routes to remove ambiguity related to keys and simplify routing concerns.
   A good example is @mitchell852 's recent PR for comments on Delivery Service Requests. https://github.com/apache/incubator-trafficcontrol/pull/2027/files#diff-e1d71774f8ad89e82bd76378c68555e3R117
   So instead of "/api/$version/cachegroups/:id/fallbacks" the route could be formed: "/api/$version/cachegroup_fallbacks" and the cachegroup id would be provided as a query parameter.
   
   Change the api response to include the cachegroup id in each fallback object in the array. This allows for more options for filtering and more accurately represents the data in the database.
   
   Change the name key to something more descriptive / tied to the fallback cachegroup to make it clear.
   
   With these changes the GET request would change from:
   
   ```
   GET /api/1.3/cachegroups/1/fallbacks
   
   	{
          "response": [
             {
                   "order":10,
                   "name":"GROUP2"
             },
             {
             	"order":11,
             	"name":"GROUP3"
             }
          ]
       }
   ```
   
     to:
   
   ```
     GET /api/1.3/cachegroup_fallbacks?cachegroupID=1
   
     	{
          "response": [
             {
                  "cachegroupID":1
                  "order":10,
                  "fallbackName":"GROUP2"
             },
             {
                   "cachegroupID":1
             	"order":11,
             	"fallbackName":"GROUP3"
             }
          ]
       }
   
   ```
      
   
   These changes will allow the api to easily use some prebuilt components and will give us some additional functionality for free in go, such as being able to filter by the fallback group's name and get all the cachegroups that fall back to it for example.

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


With regards,
Apache Git Services