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

enh: use PUT/PATCH for updating and move to API v2.2 #1809

Merged
merged 2 commits into from Dec 6, 2023

Conversation

Chartman123
Copy link
Collaborator

@Chartman123 Chartman123 commented Nov 29, 2023

This fixes #1464 by adding new PUT/PATCH routes for current POST routes that update data.

Additionally, this changes the API level to v2.2 and marks the POST endpoints as deprecated. The will be removed in v3 of the API as a breaking change.

Changes:

Name Path Current Verb New Verb
config#updateAppConfig /config/update POST PATCH
api#newForm /api/{apiVersion}/form POST POST
api#cloneForm /api/{apiVersion}/form/clone/{id} POST POST
api#updateForm /api/{apiVersion}/form/update POST PATCH
api#newQuestion /api/{apiVersion}/question POST POST
api#updateQuestion /api/{apiVersion}/question/update POST PATCH
api#reorderQuestions /api/{apiVersion}/question/reorder POST PUT
api#newOption /api/{apiVersion}/option POST POST
api#updateOption /api/{apiVersion}/option/update POST PATCH
shareApi#newShare /api/{apiVersion}/share POST POST
shareApi#updateShare /api/{apiVersion}/share/update POST PATCH
api#exportSubmissionsToCloud /api/{apiVersion}/submissions/export POST POST
api#insertSubmission /api/{apiVersion}/submission/insert POST POST

Explication:

  • PUT: all values including unchanged are sent
  • PATCH: only changed values are sent

Signed-off-by: Christian Hartmann chris-hartmann@gmx.de

@Chartman123 Chartman123 added enhancement New feature or request php PHP related ticket javascript Javascript related ticket 3. to review Waiting for reviews labels Nov 29, 2023
@Chartman123 Chartman123 self-assigned this Nov 29, 2023
@Chartman123 Chartman123 added the technical debt Technical issue label Nov 29, 2023
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Merging #1809 (7a147d9) into main (f02b3bd) will not change coverage.
Report is 22 commits behind head on main.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1809   +/-   ##
=========================================
  Coverage     43.96%   43.96%           
  Complexity      646      646           
=========================================
  Files            58       58           
  Lines          2550     2550           
=========================================
  Hits           1121     1121           
  Misses         1429     1429           

@Chartman123 Chartman123 changed the title enh: use PUT for updating and move to API v2.2 enh: use PUT/PATCH for updating and move to API v2.2 Nov 29, 2023
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
Copy link
Collaborator

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, two comments but overall 🧹

appinfo/routes.php Show resolved Hide resolved
appinfo/routes.php Outdated Show resolved Hide resolved
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Chartman123 <chris-hartmann@gmx.de>
@susnux susnux merged commit 7f5ce62 into main Dec 6, 2023
43 of 44 checks passed
@susnux susnux deleted the enh/update-endpoints-put branch December 6, 2023 16:48
@Chartman123
Copy link
Collaborator Author

You were a little bit too quick with merging... I wanted to rebase this again and have the two commits in one ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request javascript Javascript related ticket php PHP related ticket technical debt Technical issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move POST endpoints that update data to PUT/PATCH
2 participants