Hi, i'm trying to use UnityWebRequest to send a form to a Ruby on Rails server, but the error, HTTP/1.1 404 Not Found, keep comming.
My code is here:
public void Update_GI_Score()
{
StartCoroutine(Update_GI_Score_FORM());
}
IEnumerator Update_GI_Score_FORM()
{
WWWForm form = new WWWForm();
form.AddField("myField", "myData");
Game game = Singleton.GameInstance;
foreach (Score s in game.scores)
{
form.AddField("name", s.Name);
form.AddField("value", s.rate.ToString());
}
var url = RequestController.Instance.baseURL + "atualiza_score";
UnityWebRequest www = UnityWebRequest.Post(url, form);
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
Debug.Log("Form upload complete!");
}
}
In the rails routes i got:
post 'atualiza_score', controller: 'integracao_games', action: :atualiza_score
so how can i get the form correctly, i need to save the field into a database
thanks.
↧