refactor(api): simplify instance management endpoints
- Change delete endpoint to use request body instead of path parameter - Modify endpoint now takes field as path parameter and instance name in body - Update README to reflect API changes - Remove unused description field from software info - Fix error message in auth token lookup
This commit is contained in:
14
router.go
14
router.go
@@ -42,18 +42,16 @@ func setupRoutes() {
|
||||
return
|
||||
}
|
||||
|
||||
if strings.HasSuffix(remainingPath, "/delete") {
|
||||
instanceName := strings.TrimSuffix(remainingPath, "/delete")
|
||||
instanceName = strings.Trim(instanceName, "/")
|
||||
DeleteInstanceHandler(w, r, instanceName)
|
||||
if remainingPath == "delete" {
|
||||
DeleteInstanceHandler(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
if strings.Contains(remainingPath, "/modify/") {
|
||||
parts := strings.SplitN(remainingPath, "/modify/", 2)
|
||||
if strings.HasPrefix(remainingPath, "modify/") {
|
||||
parts := strings.SplitN(remainingPath, "/", 2)
|
||||
if len(parts) == 2 {
|
||||
instanceName := strings.Trim(parts[0], "/")
|
||||
ModifyInstanceHandler(w, r, instanceName)
|
||||
field := parts[1]
|
||||
ModifyInstanceHandler(w, r, field)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user