Update Definition Through Rest Not Working

1027
9
Jump to solution
02-18-2019 10:25 AM
Highlighted
MVP

I am trying to update a feature service definition following the process described in this document: https://www.esri.com/arcgis-blog/wp-content/uploads/2014/10/How-to-Update-Hosted-Feature-Service-Sch... 

Specifically, I am trying to set the sourceSchemaChangesAllowed property to false (and eventually back to true). So in the admin page of my service URL, I go to update definition.

I change true to false in the above, and then replace the last edited field with empty double quotes. It returns the following page with no error:

But when I go to my feature service again, the change has no been made.

 

This is a similar issue to this Geonet post: Updates in JSON feature service edit not taking. A bug was filed for making the same operation on different fields, with no workaround provided. Is this also a bug, and if so, does anyone have a workaround?

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor III

Philip,

I have just tested this and I do not really see any bug here.

In the view you can use something like:

https://url/ArcGIS/rest/admin/services/myViewName/FeatureServer/updateDefinition

{
   "hasStaticData" : false,    // You need to set this property to false only if this property is set to true
   "sourceSchemaChangesAllowed" : true
}

Pl. note that all views need to set this property to true in order to have this property to be true in the source feature service.

Pl. try it again in the view and let me know what error you are getting.

Khaled

View solution in original post

9 Replies
Highlighted
Occasional Contributor III

sourceSchemaChangesAllowed property can only be set on views.

So for each view you have from the source, you will need to update sourceSchemaChangesAllowed.

Once all views has set this property, then the source will update its status of the sourceSchemaChangesAllowed.

Pl. note sourceSchemaChangesAllowed property on a source feature service that has views is computed. If any view has this property is false, then the source will be false.

Khaled Hassen

Online feature service Lead

Highlighted
MVP

Thanks Khaled,

That's really good information to have. I tried to change the value of this using the same method for the views, and the edit didn't take.

The views are created through a script, so it wouldn't be a hassle to recreate them, but it would erase a lot of work that went in to the operations dashboard (since recreating the views will change their id). So ideally, we want to change just this property on the view layers. Do you have any advice?

Reply
0 Kudos
Highlighted
Occasional Contributor III

Philip,

I am assuming you are setting the property in the view service edit definition admin API and not the view layer admin editDefintion admin API.

Can you pl. be sure you have no client cache (browser cache). Did you try to perform any schema changes in the source and you failed?

This is supposed to work. I will check to see if we have any issue with this.

Thanks

Khaled

Reply
0 Kudos
Highlighted
MVP

Thanks for checking again on this, Khaled.

I am accessing update definition the following way: Clicking on the feature layer from my AGOL content folder. Then, under layers, clicking the link to "Service URL." That takes me to the REST Services Directory, with the path Home > services > view_layer_name > feature_service_name. Then I change the URL to rest/admin/services, scroll down, and choose update definition. I'm not sure if that answers your questions about the view service vs view layer, but let me know if there's a better way to access.

Clearing my cache did not fix the issue. 

My feature service was made through Survey123 Connect. Once we made view layers, we were not able to make schema changes through Connect. So we tried to add fields through the AGOL data tab, but the button to add a field didn't work. We also tried in Pro but it returned an error. Through testing we've found that the "Add Field" button turns on when the sourceSchemaChangesAllowed property is true, and disappears when it is set to false. We also have a test feature service made in a similar way that we have been testing on.

Thanks again,

Philip

Reply
0 Kudos
Highlighted
MVP

In addition to the path above, I also tried click back to my view feature server, like in the screenshot below of my test feature service. The change still updates as if it went through, but nothing is actually changed. This screenshot is after I changed sourceSchemaChangesAllowed to false.

Reply
0 Kudos
Highlighted
MVP Notable Contributor

Philip,

I remember having a similar issue but, since it was so long ago, I don't remember too much about it. Here is the thread (and Khaled responds to me too!):

https://community.esri.com/message/756674-unable-to-update-feature-service-layer-definition 

It sounds like, in the end, some things cannot be updated.

Highlighted
MVP

Thanks Adrian! I do have a sneaking suspicion this is something that just can't be changed. If that's the case, I hope my question gets it filed as a bug, or at least provides a clear use case for having the capability to make more changes through Update Definition (since this change cascades all the way down to not being able to add a field to my Survey123 form)

Reply
0 Kudos
Highlighted
Occasional Contributor III

Philip,

I have just tested this and I do not really see any bug here.

In the view you can use something like:

https://url/ArcGIS/rest/admin/services/myViewName/FeatureServer/updateDefinition

{
   "hasStaticData" : false,    // You need to set this property to false only if this property is set to true
   "sourceSchemaChangesAllowed" : true
}

Pl. note that all views need to set this property to true in order to have this property to be true in the source feature service.

Pl. try it again in the view and let me know what error you are getting.

Khaled

View solution in original post

Highlighted
MVP

Khaled,

Working in the feature server, and changing "hasStaticData" to the opposite value of "sourceSchemaChangesAllowed" allowed me to successfully change the property. I tested turning it both true and false, and the property in the hosted feature service changed accordingly. 

Thanks so much!!

Philip

Reply
0 Kudos