I'm new to unity but I managed to do the http get, post, delete methods. My problem occurs in the PUT, I get the call right to the server, however it does not do anything, and changes everything to null, I suppose it is an error in the variable "json" but I can not fix it, if I do the put method with other tools as Postman is everything goes perfect
public void botonActualizar(){
StartCoroutine(Upload());
}
[System.Serializable]
public class myClase
{
public string nombre;
public string descripcion;
}
public IEnumerator Upload()
{
string url = "http://localhost:3001/v1/0001";
myClase myObject = new myClase();
myObject.nombre = "nombre";
myObject.descripcion = "ejemplo";
string json = JsonUtility.ToJson(myObject);
UnityWebRequest www = UnityWebRequest.Put(url, json);
yield return www.Send();
if (www.isError)
{
Debug.Log(www.error);
}
else
{
Debug.Log("upload complete!");
}
}