package main import ( "net/http" ) type response struct { Action string `json:"action"` Status string `json:"status_code"` Result interface{} `json:"result"` } // GET: http://example.com/api/action/shorten?key=API_KEY_HERE&url=https://google.com&custom_ending=CUSTOM_ENDING // Response: {"action": "shorten","result": "https://example.com/5kq"} func APIRequest(w http.ResponseWriter, r *http.Request) { }