Updating an entity and handling PUT request conflict responses
Many entities in the Qlik Sense Repository Service (QRS) API include the modifiedDate property, which is used to prevent conflicts in the repository database. If the modifiedDate property in the repository database is more recent than the one you are including in your request, there is a conflict and the QRS returns a 409 Conflict error.
The best way to modify an entity is to retrieve that entity, modify the specific properties you want to change, and then do an update, including the entire entity as the body of the request. You must always include the entity ID and modifiedDate when performing an update. The entity ID of the body and of the URL must match.
For some entities, if you omit a property in the updated JSON you pass in the request body, QRS substitutes a default value (i.e., performs an implicit update). Although most PUT requests support a partial update (meaning that you can safely omit properties to leave them untouched), not all requests work this way, and there is no easy way to determine this in advance. We recommend that you always include the complete entity when performing updates.
When you edit several entities at once in a selection set, the latest modifiedDate in the selection set is used for conflict handling.
To update an entity:
- Get the entity from the repository database.
The modifiedDate property is included in the returned entity.
- Modify the properties of the entity, but do not change the modifiedDate property.
- Include the entire modified entity as the body in a new update request.
- Send the request to update the entity in the repository database.