Comments (2)
Currently we only implemented this behavior on the default_bucket
plugin, which has a lot of other specificities.
One possibility is to use the concurrency control requests headers in your client, to create only if it doesn't exist.
$ http PUT https://kinto.dev.mozaws.net/v1/buckets/a "If-None-Match: *" -a user:pass
HTTP/1.1 201 Created
Access-Control-Expose-Headers: Alert, Content-Length, Backoff, Retry-After, Content-Type
Connection: keep-alive
Content-Length: 152
Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; base-uri 'none';
Content-Type: application/json
Date: Wed, 10 Nov 2021 14:48:40 GMT
ETag: "1636555720093"
Last-Modified: Wed, 10 Nov 2021 14:48:40 GMT
Server: nginx
X-Content-Type-Options: nosniff
{
"data": {
"id": "a",
"last_modified": 1636555720093
},
"permissions": {
"write": [
"basicauth:631c2d625ee5726172cf67c6750de10a3e1a04bcd603bc9ad6d6b196fa8257a6"
]
}
}
If it exists it will return 412 (that your client code can ignore on purpose)
$ http PUT https://kinto.dev.mozaws.net/v1/buckets/a "If-None-Match: *" -a user:pass
HTTP/1.1 412 Precondition Failed
Access-Control-Expose-Headers: Alert, Content-Length, Backoff, Retry-After, Content-Type
Connection: keep-alive
Content-Length: 162
Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; base-uri 'none';
Content-Type: application/json
Date: Wed, 10 Nov 2021 14:48:42 GMT
ETag: "1636555720093"
Last-Modified: Wed, 10 Nov 2021 14:48:40 GMT
Server: nginx
X-Content-Type-Options: nosniff
{
"code": 412,
"details": {
"existing": {
"id": "a",
"last_modified": 1636555720093
}
},
"errno": 114,
"error": "Precondition Failed",
"message": "Resource was modified meanwhile"
}
from kinto.
also you can manually create empty collection based on notification on backend level.
For example: create profile collection when new account created.
from kinto.
Related Issues (20)
- Responsible disclosure policy HOT 1
- Replace current Kinto Admin setup with `kinto-admin` git submodule HOT 1
- Replace `psycopg2` with `psycopg2-binary`?
- id missing in the payload for the endpoint POST /accounts HOT 7
- Last modified field in collection is incorrect HOT 7
- Either don't send email notification or only selectively notify about changes to nimbus-desktop-experiments
- Wait until database starts before starting Kinto in Docker Compose HOT 2
- Replace `raven` by `sentry-python`
- Custom Certificate for OpenId / urllib3? HOT 1
- Add support for SQLAlchemy >=2.0
- Drop support for Python 3.7? HOT 1
- HTTP 500 on create bucket error":"Internal Server Error" HOT 2
- Performance for plural endpoints is suboptimal
- Kinto does now show permissions if you have `write` access on the parent object HOT 1
- Allow for an opt-in feature to show resource owners
- Demo does not work
- Investigate selenium test errors HOT 1
- Duplicated lists of dependencies HOT 2
- Building and running docker locally causes the UI to not load
- Preview thumbnail of attached image file is not shown in UI
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 kinto.