Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for upserts based on natural keys #125

Open
thgreasi opened this issue Feb 26, 2018 · 2 comments
Open

Add support for upserts based on natural keys #125

thgreasi opened this issue Feb 26, 2018 · 2 comments

Comments

@thgreasi
Copy link
Member

It would be great if we could do an upsert for a resource using its unique properties as a key.
We are currently limited to POSTing and then PATCHing when erroring with a unique key constrain violation.
For example, for a resource where <col1> & <col2> are a unique pair, we would want to make an upsert to insert or update a record containing a note, by sending a request containing <col1: X>, <col2: Y> and <note: Z>.

Additionally, it would be great to have these upserts work as part of batch operations as well.

See: https://github.com/resin-io/resin-api/issues/765

@Page-
Copy link
Collaborator

Page- commented Sep 3, 2020

This is available via PUT but it does set any non-specified fields back to defaults - I think there's value in a version that does not reset defaults as well

@thgreasi
Copy link
Member Author

thgreasi commented Sep 3, 2020

Do the fields in the id field also have to be in the body of the POST @Page-?
Maybe an example curl or pinejs-client one would be even better and good for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants