Will_Branch

Using addFeatures?f=json&features POST JSON feature get "Invalid parameters" response

Discussion created by Will_Branch on Jun 14, 2010
Latest reply on Jun 16, 2010 by vasmel
We are trying to add points to our own AGS V10 feature server using REST in C#. Using the HTML form I can submit the same JSON feature that I am POSTing in code and it is successful. 

I don't know what is wrong with my parameters since there are no published examples for this :( :(

Was hoping to have this working for a webex today at 2:00 eastern so I can get an OK to go forward on using Feature Services.

Thanks!

here is my code:
        public void AddNewFeature(string aJSONString)
        {
            string aUrl = string.Format("{0}/{1}", _url.AbsoluteUri, "addFeatures?f=json&features");
            Uri aUri = new Uri(aUrl);
            string aRespStr = "";

            using (WebClient client = new WebClient())
            {
                client.Headers["Content-type"] = "application/json";
                client.Encoding = Encoding.UTF8;
                aRespStr = client.UploadString(aUri, aJSONString);
                   //aRespStr = client.UploadString(aUri, HttpUtility.UrlEncode(aJSONString));
            }
        }


Here is the JSON feature I am posting:
[{"geometry":{"x":-9107536.44005102,"y":3321905.0880102},"attributes":{"HOUSE_NO":"123456","ST_NAME":"WillTest","COMMENTS":"IslandHouse"}}]

Fiddler info re: request:
POST http://vmgsc/ArcGIS/rest/services/LeesburgFL_FeatureServiceTest/FeatureServer/0/addFeatures?f=json&features HTTP/1.1
Content-Type: application/json
Host: vmgsc
Content-Length: 79
Expect: 100-continue

[{"geometry":{"x":403778.3,"y":1604409},"attributes":{"HOUSE_NO":"555666777"}}]

Fiddler info re: Response:
HTTP/1.1 200 OK
Content-Type: text/plain;charset=utf-8
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Mon, 14 Jun 2010 13:55:16 GMT
Content-Length: 98

{"error":{"code":400,"message":"Unable to complete  operation.","details":["Invalid parameters"]}}

Outcomes