Github user mitchell852 commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafficcontrol/pull/435#discussion_r113056228
  
    --- Diff: traffic_ops/app/lib/TrafficOpsRoutes.pm ---
    @@ -657,6 +657,23 @@ sub api_routes {
        # Supports ?orderby=key
        $r->get("/api/$version/roles")->over( authenticated => 1 )->to( 
'Role#index', namespace => $namespace );
     
    +   # -- CAPABILITIES
    +   # Supports ?orderby=key
    +   $r->get("/api/$version/capabilities")->over( authenticated => 1 )->to( 
'Capability#all', namespace => $namespace );
    +   $r->get("/api/$version/capabilities/:name")->over( authenticated => 1 
)->to( 'Capability#name', namespace => $namespace );
    +   $r->put("/api/$version/capabilities/:name")->over( authenticated => 1 
)->to( 'Capability#update', namespace => $namespace );
    +   $r->post("/api/$version/capabilities")->over( authenticated => 1 )->to( 
'Capability#create', namespace => $namespace );
    +   $r->delete("/api/$version/capabilities/:name")->over( authenticated => 
1 )->to( 'Capability#delete', namespace => $namespace );
    +
    +   # -- API-CAPABILITIES
    +   # Supports ?orderby=key
    +   $r->get("/api/$version/api_capabilities")->over( authenticated => 1 
)->to( 'ApiCapability#all', namespace => $namespace );
    +   $r->get("/api/$version/api_capabilities/:id")->over( authenticated => 1 
)->to( 'ApiCapability#index', namespace => $namespace );
    +   $r->get("/api/$version/api_capabilities/capability/:name")->over( 
authenticated => 1 )->to( 'ApiCapability#capName', namespace => $namespace );
    --- End diff --
    
    so we typically use query params to filter data. so i don't think this is 
needed:
    
    $r->get("/api/$version/api_capabilities/capability/:name
    
    instead,  you can just do GET api/*/api_capabilities?capability=[whatever] 
but just make sure your "index" action can handle the query param to filter the 
result set.
    
    Here's an example where we use a query param to filter regions by division:
    
    
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/API/Region.pm#L28


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to