- Home /
Question by
Pranay · Jun 02, 2015 at 11:22 AM ·
jsonweb services
Post Json request Unity web
I want to post a request using json to online web services.
This is my code:
JSONObject j = new JSONObject ();
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", "Person");
j.AddField ("RequestedGameId", "375b43c0-91be-e011-a505-001aa020d699");
j.AddField ("RequestedPersonId", "09996f84-1a06-e211-a518-001aa020d699");
string json = j.ToString ();
Dictionary<string, string> header = new Dictionary<string, string>();
header.Add ("Accept", "application/json");
header.Add ("Content-Type", "text/json");
byte[] encode = Encoding.ASCII.GetBytes (json.ToCharArray ());
WWW getConfig = new WWW ("http://192.168.0.140/services/scoreupload.svc/json/GetGameConfigurationLite", encode, header);
This however keeps returning "500 Internal Server Error"
Why? and how do I make it work?
Comment
Answer by Naxilos · Mar 19, 2019 at 10:54 AM
"500 Internal Server Error" says that the problem is in fact in server, not in your unity code.
Your answer
Follow this Question
Related Questions
Json . NET, iOS and AOT 1 Answer
How do I get a number out of a JSON file with JSONObject.cs 1 Answer
Import oculus configuration unity .json file 1 Answer
Using html JSON script to store varibles 1 Answer
Parsing Json from www response 2 Answers