func (a *AccountHandler) GetLatest(w rest.ResponseWriter, r *rest.Request) { code := r.PathParam("accountCode") latest := new(core.AccountSnapshotLatest) err := meddler.QueryRow(a.db, latest, "SELECT * FROM v_account_snapshot_latest WHERE account_code = $1", code) if err != nil { a.u.HandleError(err, w, r) return } path := fmt.Sprintf("/v1/accounts/%s/%s", code, latest.Latest.Format(time.RFC3339Nano)) url := r.UrlFor(path, make(map[string][]string)) w.Header().Add("Location", url.String()) w.WriteHeader(http.StatusSeeOther) }