Valentin Gomez

Generation

generate functionTue, 03 Jan 2023

POST data from https://apiadv.sintia.com.ar/Help/Api/POST-Ratificacion-Login

func Login(username, password string) { url := "https://apiadv.sintia.com.ar/Ratificacion/Login" var jsonStr = []byte(`{"Username":"` + username + `","Password":"` + password + `"}`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Content-Type", "application/json") client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println("response Status:", resp.Status) fmt.Println("response Headers:", resp.Header) body, _ := ioutil.ReadAll(resp.Body) fmt.Println("response Body:", string(body)) }

Questions about programming?Chat with your personal AI assistant