package discourse import ( "encoding/json" "fmt" "net/http" ) type UserResponse struct { User User `json:"user"` } type User struct { ID string `json:"id"` Username string `json:"username"` Moderator bool `json:"moderator"` Admin bool `json:"admin"` Groups []Group `json:"group"` } func GetUser(config ApiConfig, username string) { url := fmt.Sprintf("%s/users/%s.json?api_key=%s&api_username=%s", config.Endpoint, username, config.ApiKey, config.ApiUser) fmt.Println(url) response, _ := http.Get(url) var result User json.NewDecoder(response.Body).Decode(&result) fmt.Println(result) }