unity3d - posting a JSON request in Unity -
i know how post json request server in unity.
for example:
my url is: http://www.neurobic.com/services/scoreupload.svc/json/getgameconfigurationlite
i need profile of logged in player , service requires few parameters passed. example.
j.addfield ("id", "1234567890"); j.addfield ("magickey", applicationservices.magickey); j.addfield ("requestedby", "09996f84-1a06-e211-a518-001aa020d699"); j.addfield ("timestamp", "/date(1547535370953)/"); j.addfield ("requestsource", 1); j.addfield ("requestedgameid", "375b43c0-91be-e011-a505-001aa020d699"); j.addfield ("requestedpersonid", "09996f84-1a06-e211-a518-001aa020d699");
this service responds json information based on parameters of posted request.
so how should it.
check out wwwform documentation.
it should this.
void start() { startcoroutine(postit()); } private ienumerator postit() { wwwform j = new wwwform(); j.addfield("id", "1234567890"); j.addfield("magickey", applicationservices.magickey); j.addfield("requestedby", "09996f84-1a06-e211-a518-001aa020d699"); j.addfield("timestamp", "/date(1547535370953)/"); j.addfield("requestsource", 1); j.addfield("requestedgameid", "375b43c0-91be-e011-a505-001aa020d699"); j.addfield("requestedpersonid", "09996f84-1a06-e211-a518-001aa020d699"); www www = new www("http://www.neurobic.com/services/scoreupload.svc/json/getgameconfigurationlite", j); yield return www; debug.log(www.text); // => json response }
Comments
Post a Comment