LiteSun commented on issue #861:
URL: 
https://github.com/apache/apisix-dashboard/issues/861#issuecomment-742881219


   > After reading the above discussion and try to implement it for a while.
   > 
   > I design two APIs like the following.
   > 
   > 
   > 
   > 1.
   > 
   > `GET /api/labels/:type?{label=key,key:value,key:value}`
   > 
   > 
   > 
   > Type means the specified response e.g: "upstream", "ssl", "service", 
"consumer".
   > 
   > If type is "all", it means to get all of them.
   > 
   > 
   > 
   > Because of the lib 
[droplet](http://github.com/shiningrush/droplet/wrapper/gin) can't get total 
values with the same parameters key(Like 
`label=key&label=key:value&label=key2:value2`).The solution is that we use `,` 
to separate different KV(Like "label=key,key:value,key2:value2").
   > 
   > 
   > 
   > Response:
   > 
   > ```
   > 
   > [
   > 
   >   {"key":  "value"},
   > 
   >   {"key":  "value2"},
   > 
   >   {"key2":  "value3"},
   > 
   >   ...
   > 
   > ]
   > 
   > ```
   > 
   > 
   > 
   > 2.
   > 
   > `GET /apisix/admin/routes?label=key,key2:value,key3:value3`
   > 
   > 
   > 
   > Response:
   > 
   > ```
   > 
   > {
   > 
   >     "code":0,
   > 
   >     "message":"",
   > 
   >     "data":{
   > 
   >         "rows":[
   > 
   >          ],
   > 
   >         "total_size":0
   > 
   >     },
   > 
   >     "request_id":"91476327-9ae6-4d33-816d-16f528647d54"
   > 
   > }
   > 
   > ```
   > 
   > 
   > 
   > BTW, not only the `route` module has the label option, "upstream", 
"route", "service", "consumer","ssl" also have.Do we need to implement the API 
that search by the label?
   > 
   > 
   
   I think we need to implement the route search api first(M2.2) then implement 
others. 
   
   Any suggestions about the API design @nic-chen ?


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to