-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
"Idempotency" of PATCH for the REST API #12196
Comments
Currently I did identify 3 Problems:
I can work on the last two issues and provide a PR. This does not necessarily need to happen in the beta phase, because these changes should not affect the current documented behaviour. Another thing is reflecting these changes in the API spec. But since the current documented behaviour is not affected, this could be added later. |
Regarding the choice field, as a developer it makes the most sense to me the way it's working currently. Changing it to as mentioned will only cause confusion and it's unnecessary as the label in the dict cannot change in a post or patch. If a user tried to send a different label for an existing value, they would expect that to change but that's not possible. |
I'm fine with the proposed changes if they can be implemented in a manner that does not break backward compatibility. @amhn I'll assign this to you since you kindly offered to submit a PR; happy to provide any guidance. |
Closing this out as the assigned volunteer has not completed any work and there's been no further discussion. |
NetBox version
v3.5-beta
Feature type
Change to existing functionality
Proposed functionality
The different API endpoints for a model should accept/return the same Model[1].
For example it should be possible to use the output of GET /api/ipam/ip-addresses/1/ and either POST it to /api/ipam/ip-addresses/ or PATCH it to /api/ipam/ip-addresses/1/ and (if the new object does not violate uniqueness constraints) get an updated or new object.
[1] This does not mean read_only fields should become writable, read_only fields are already ignored most of the time on PATCH/POST requests.
Use case
This would make it easier for a new user to discover the API because he can just GET an existing object, modify some fields and POST/PATCH it to get the desired changes.
For script development this would also help, because the returned object can be the same as sent one.
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: