0

I developed a small web application that contains a Map view, and is loaded with features that were published. So I have (FeatureServer, VersionManagementServer). I decided to to add the functionality of editing the data on the map, by making the user, create a data version using EsriRequest to access ArcGIS REST URL for creating versions. Now users can create a version from the application, but I noticed that editing the features within an editing session of the version reflects the default version. Basically beats the purpose of the versioning. What am I missing here ?

2
  • If you're creating versions on the fly in an app, then you're using Branch Versioning, yes? It's not the same as Traditional Versioning, and requires safeguards to protect the DEFAULT version. Esri has a blog on Branch Versioning, the second part of which addresses basic prep of a branch versioned dataset.
    – Vince
    Mar 14, 2022 at 11:43
  • @Vince, thanks for the link. Yes I am creating Branch Versions on the fly, using the /create. I went through the blog, and now I am familiar with branch versioning. I was able to create a version using arcpro, and set the current version to it. Now I am trying to figure out how to do that using the Javascript Api on my web application.
    – ZZZ
    Mar 14, 2022 at 12:44

1 Answer 1

1

I found what I am looking for right here, https://www.youtube.com/watch?v=P0TkcMs8U6Y To summarise, you will have to make HTTP requests to full fill the versioning cycle.

Lets say you want to Create a version, do some editing, and then storing your edits.

You will have to do the following:-

Create a version using the Rest URL, passing the version name of your choosing. You will have to use a Fetch API such as XmlHTTPRequest or anything as such to send your request to {ServiceURL}/VersionManagmentServer/create You will have to pass the Version Name as a URL param, take a look at the required param and the optional params on esri's REST Api webpage https://developers.arcgis.com/rest/services-reference/enterprise/create.htm

if the request's response is successful, you will receive a version GUID. This GUID should be stored somewhere in your Application since it will be used in the URL to access Version page and all the allowed cycle functions.

Now that your version is created, you need to start reading the version, and then start editing.

you can access the Version Page through the {ServiceURL}/VersionManagmentServer/versions/{VersionGuid}

Before reading a version and/or editing the version, the client will need to generate another GUID that is responsible for this client. it is called session ID, using this GUID, you will be able to track the current branch of the version created, and revisit the branch in the future.

To edit some feature, you will have to use the version function startEditing, which can be accessed through {ServiceURL}/VersionManagmentServer/versions/{VersionGuid}/startEditing, you will have to pass the client session GUID as a URL parameter. If success was returned, you are ready to start editing.

Take a look at the Edit operation https://developers.arcgis.com/rest/services-reference/enterprise/start-editing.htm

Editing features will not be discussed here as there many examples on how to edit feature attributes, shapes, etc on esri's sample, but I will add that when you use the ApplyEdits method, you will have to pass in the created version name and the session id as parameters to make the change in the current session. https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits

once you are finished editing you have to use stopEditing which if ypu dont do your version session will be locked, and you will not see any of your changes in the version. so you need to use the function stopEditing. {ServiceURL}/VersionManagmentServer/versions/{VersionGuid}/stopEditing,

You have to pass a boolean of true to save the edits, or false to discard the edits as a URL parameter in your request.

I will not cover the posting and reconciling and the other functions, you can visit the REST Api url below and get the full picture https://developers.arcgis.com/rest/services-reference/enterprise/version-management-service.htm

1
  • 1
    Link-only answers are only useful as long as the link lasts, and often down-voted or deleted. You should summarize the content if you want othe answer and/or question to be preserved.
    – Vince
    Mar 15, 2022 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.