C# AddFeature

3910
4
Jump to solution
09-30-2013 08:45 AM
DeanRich
New Contributor
My setup
C# 4.0
Silverlight 5
ArcGIS 10.0

Issue:

I'm trying to use the REST API to add a feature.  I'm doing it this way because we want to be able to add a polygon without using a map.  When I post the JSON data we get a message back saying it was successful and we get the ObjectId back from the REST response.  However the attribute data that I attached to the request AND the polygon were not set at all.  Both have a <Null> value but I am able to verify the new record was inserted. 

Now when I run this same process on a the same feature class (sort of) but within our arcGIS 10.1 server it works perfect.  The record is inserted and all attribute and polygon data is visible in the newly inserted record.

As far as I can tell there is no difference between the 10.0 and 10.1 feature class other than the version of arcGIS.  The documentation that I found leads me to believe this should work on both 10.0 and 10.1.

Could it be that what I'm trying to achieve is only possible in 10.1.  From the documentation I found it looks like it should work on 10.0 and 10.1 but I could be mistaken.

I've compared the response/request using fiddler between using the webform addfeature and the rest call to add the feature and they are the same request/response messages.

Any suggestions are greatly appreciated as I've tried all I can think of.

Thanks,

Dean
0 Kudos
1 Solution

Accepted Solutions
DeanRich
New Contributor
Thanks for the reply.  I actually found out what the issue was.  I used fiddler to compare the JSON that was passed to 10.1 and to 10.0 from the webform when calling the addfeature rest method.  In 10.1 "Geometry" and "Attributes" start with a capital letter.  In 10.0 they should start with a lower case letter ("geometry, "attributes").  With JSON being case senstive this makes sense.

View solution in original post

0 Kudos
4 Replies
AnttiKajanus1
Occasional Contributor III
What kind of response you got from service when added feature and how you tried to get the feature information back?

One thing that you could do is to use /applyEdits endpoint. I usually work only with that when using REST API directly since I can do add/update/delete with one implementation. Haven't tested that with 10.0 thou.
0 Kudos
DeanRich
New Contributor
Thanks for the reply.  I actually found out what the issue was.  I used fiddler to compare the JSON that was passed to 10.1 and to 10.0 from the webform when calling the addfeature rest method.  In 10.1 "Geometry" and "Attributes" start with a capital letter.  In 10.0 they should start with a lower case letter ("geometry, "attributes").  With JSON being case senstive this makes sense.
0 Kudos
AnttiKajanus1
Occasional Contributor III
Good that you got it fixed and thanks for to info. This is something that its good to know.
0 Kudos
JenniferLink
New Contributor III
Hello,
I'm running into the very same issue when attempting to send a polygon feature that I have created in JSON to the ArcGIS Server REST API AddFeature endpoint (version 10.0). A new record is being added to my source feature class, however all of the attributes are null as well as the polygon field. The response I am getting is that the post was successful. I already had the lowercase on the attributes and geometry parameters which is required for 10.0.  Does anyone have any other options I could explore? The JSON I am sending is below. Any help would be appreciated.
Thanks!
Jen

[{"feature":{"attributes":{"HasComments":0,"HasHyperlinks":0,"Narrative":"This is test 1","Title":"Test 1","ActiveDateRangeType":0,"IsTimeSlice":0,"SupportsComments":0,"NoteGroupName":""},"geometry":{"rings":[[-9825778.4024791,5168952.50228657],[-9825604.53795373,5168372.95386866],[-9825855.67560149,5167658.17748657],[-9826242.04121343,5167503.63124179],[-9826145.44981045,5166730.90001791],[-9826802.27135075,5166750.21829851],[-9827285.22836567,5166672.94517612],[-9827806.82194179,5166769.53657911],[-9828231.82411492,5167175.22047164],[-9828289.77895672,5167793.40545075],[-9828405.6886403,5168411.59042985],[-9828367.0520791,5168952.50228657],[-9828019.32302836,5169338.86789851],[-9826744.31650895,5169435.45930149],[-9826184.08637164,5169512.73242388],[-9825778.4024791,5168952.50228657]]}}}]
0 Kudos