more code
This commit is contained in:
25
server/handler/getIncident.go
Normal file
25
server/handler/getIncident.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetIncident responds to the link generated in the response to a New Snow
|
||||
func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// TODO
|
||||
|
||||
path := r.URL.Path
|
||||
// Expected format: /api/now/table/incident/{id}
|
||||
parts := strings.Split(path, "/")
|
||||
|
||||
if len(parts) != 6 || parts[1] != "api" || parts[2] != "now" || parts[3] != "table" || parts[4] != "incident" {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
id := parts[5] // Extract {id}
|
||||
fmt.Fprintf(w, "Incident ID: %s", id)
|
||||
}
|
Reference in New Issue
Block a user