Comments (6)
I'm starting to feel again that specifying baseVersion
in the request body might not be semantic for a PATCH request. In a PATCH request, you're updating an entity with the specified label and data. However, you're not updating the base version of the entity, because entities don't have base versions: base versions are a property of entity versions (a subresource of entities).
What if we specified the base version in a query parameter? That might be more semantic, and it would neatly parallel the force
query parameter. That way, every PATCH request would require some query parameter: either force=true
or a baseVersion
.
Not a strong feeling, just an idea!
from central-backend.
Couple of questions just to make sure I understand:
- Why does that endpoint return an ETag? Is it because of our use of the If-Match header?
- If the ETag changes, will we also need to change our use of the If-Match header?
By the way, I've also filed getodk/central#544, which seems thematically related. The two issues might end up being pretty separate though.
from central-backend.
that's right. Maybe etag is not required at all for GET /entities/:uuid
because from frontend we are manually setting If-Match header
from central-backend.
I didn't realize this right away, but this issue is user-facing:
- Navigate to the entity detail page for an entity with a conflict.
- Mark the entity as resolved.
- Refresh the page. The conflict summary box is still shown.
from central-backend.
We discussed this in a meeting today.
Thoughts:
- The ETag is supposed to be opaque. We shouldn't tell API users to specify something in particular for the If-Match header, in case we decide to change the format of the ETag in the future.
- However, if the ETag is opaque, then the only way to specify the If-Match header would be to fetch an individual entity. It'd be nice to be able to fetch the list of entities (the entity OData), then specify If-Match when updating each one (so that
?force=true
isn't needed).
Decisions:
- Specify the
baseVersion
in the request body rather than using an ETag. We don't document the ETag or If-Match headers in the API docs currently, so this isn't a breaking change.- Frontend will need to specify this.
- Don't return a bespoke ETag (just the one that Express generates).
Open question:
- Should we return a different error code (a 412) if the user specifies a base version that is not the current version?
To document:
- When you update an entity via the API, you can specify whether you want to mark the conflict as resolved at the same time using the
resolve
query parameter. The API will reject if there is no conflict. - If you don't specify
?resolve=true
, then you will be able to make an update immediately after someone else marks the conflict as resolved. (You and Alice fetch an entity at the same time, then Alice marks the conflict as resolved, then even without refetching the entity, you will be able to update it.)
from central-backend.
I agree, @matthew-white, a query parameter does feel more expected.
from central-backend.
Related Issues (20)
- Different port numbers for pyxform-http HOT 1
- Update dependencies for v2023.5 HOT 3
- Refactor worker/entity tests HOT 1
- Get rid of `submissionCreate` from GET entities/:uuid/audits HOT 2
- Update API docs for 2023.5
- "Not found" Problem after request to submissions.csv.zip
- Update dependencies for v2024.1
- Frames used in migrations HOT 6
- Add system property like __id back to entity CSV attachment? HOT 1
- Benchmark bulk entity create API HOT 7
- Update API docs for v2024.1
- entities."deletedAt" has different type from other timestamp columns
- API documentation inconsistencies HOT 2
- Get off of slonik fork HOT 1
- OIDC login fails due to Authentik sending state QS and node-openid-client failing a check
- Streamline Form creation/update/publish paths to better fit with Entities
- Backend crash when opening hostile-named submission detail HOT 8
- Replace Should.js with Chai
- Check that client audits really get purged
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from central-backend.