spatxos commented on issue #9587:
URL: https://github.com/apache/apisix/issues/9587#issuecomment-1572166777

   > Do you mean that you want the `id` of route to be unique?您的意思是希望路由的 `id` 
是唯一的吗?
   
   For example:
   ```
   curl http://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X POST -i -d '
   {
       "name": "user-api",
       "uri": "/user-api/*",
       "upstream": {
          "nodes": {
              "127.0.0.1:1980": 1
          },
          "type": "roundrobin"
       },
   }'  # Id=1
   
   curl http://127.0.0.1:9180/apisix/admin/routes -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X POST -i -d '
   {
       "name": "user-api",
       "uri": "/user-api/*",
       "upstream": {
          "nodes": {
              "127.0.0.1:1980": 1
          },
          "type": "roundrobin"
       },
   }'  # Id=2
   ```
   Maybe for other reasons, I didn't use PUT for request 
`http://127.0.0.1:9180`, then I will add a new route, and I want to restrict 
the route addition through the name parameter.
   ```
   curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "name": "user-api",
       "uri": "/user-api/*",
       "upstream": {
          "nodes": {
              "127.0.0.1:1980": 1
          },
          "type": "roundrobin"
       },
   }'
   
   curl http://127.0.0.1:9180/apisix/admin/routes/2 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "name": "user-api",
       "uri": "/user-api/*",
       "upstream": {
          "nodes": {
              "127.0.0.1:1980": 1
          },
          "type": "roundrobin"
       },
   }'
   ```
   Or, I forgot the ID of the previous PUT request, causing a different ID to 
be used for PUT, resulting in the addition of an identical route.
   So I would like to add the name field to the judgment of unique routes 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to