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

Reorganize API endpoints and deprecate current endpoints #2079

Open
Tracked by #2041
Chartman123 opened this issue Apr 17, 2024 · 3 comments
Open
Tracked by #2041

Reorganize API endpoints and deprecate current endpoints #2079

Chartman123 opened this issue Apr 17, 2024 · 3 comments
Labels
1. to develop Accepted and waiting to be taken care of discussion Being discussed enhancement New feature or request php PHP related ticket technical debt Technical issue
Milestone

Comments

@Chartman123
Copy link
Collaborator

Chartman123 commented Apr 17, 2024

Based on the comment by @susnux, here's the proposal on how to reorganize our API endpoints:

Forms endpoints

What Current New
Get forms GET /forms ✅ GET /forms -> Parameter: type = owned
Get shared forms GET /shared_forms ❓ GET /forms -> Parameter: type = shared
New form POST /form ✅ POST /forms
Get form GET /form/:id: ✅ GET /forms/:id: -> Parameter: partial = false
Get partial form GET /partial_form/:hash: ❓ GET /forms/:id: -> Parameter: partial = true
Clone form POST /form/clone/:id: ✅ POST /forms/:id:/clone
Update form PATCH /form/update ✅ PATCH /forms/:id:
Transfer ownership POST /form/transfer ✅ - (just use patch/update)
Delete form DELETE /form/:id: ✅ DELETE /forms/:id:
Link file to form POST /form/link/:fileformat: ✅ - (just use patch/update)
Unlink file POST /form/unlink ✅ - (just use patch/update)

Questions endpoints

What Current New
Get questions - ❓ GET /questions
Get question - ❓ GET /questions/:id:
New question POST /question ❓ POST /questions
Update question PATCH /question ❓ PATCH /questions/:id:
Reorder questions PUT /question/reorder ❓ PUT /questions/reorder
Clone question POST /questioin/clone/:id: ❓ POST /questions/:id:/clone
Delete question DELETE /question/:id: ❓ DELETE /questions/:id:

Options endpoints

What Current New
Get options - ❓ GET /options
Get option - ❓ GET /options/:id:
New option POST /option ❓ POST /options
Update option PATCH /option/update ❓ PATCH /options/:id:
Reorder options - ❓ PUT /options/reorder
Clone option - ❓ POST /options/:id:/clone
Delete option DELETE /option/:id: ❓ DELETE /options/:id:

Sharing endpoints

What Current New
Get shares - ❓ GET /shares
Get share - ❓ GET /shares/:id:
New share POST /share ❓ POST /shares
Update share PATCH /share/update ❓ PATCH /shares/:id:
Delete share DELETE /share/:id: ❓ DELETE /shares/:id:

Submission endpoints

What Current New
Get submissions GET `/submissions/:formhash: ❓ GET /submissions
Get submission - ❓ GET /submissions/:id:
Download submissions GET /submissions/export/:formhash:?:fileformat: ❓ GET /submissions -> Parameters download, filetype
Export submissions to cloud POST /submissions/export ❓ POST /submissions-> Parameters fileformat, path
New submission POST /submission/insert ❓ POST /submissions
Update submission - ❓ PATCH /submissions/:id:
Delete submissions DELETE /submissions/:formid: ❓ DELETE /submissions
Delete submission DELETE `/submission/:id: ❓ DELETE /submissions/:id:
@Chartman123 Chartman123 mentioned this issue Apr 17, 2024
7 tasks
@Chartman123 Chartman123 added enhancement New feature or request php PHP related ticket discussion Being discussed 1. to develop Accepted and waiting to be taken care of technical debt Technical issue labels Apr 17, 2024
@Chartman123 Chartman123 added this to the 4.3 milestone Apr 17, 2024
@susnux
Copy link
Collaborator

susnux commented Apr 20, 2024

❓ GET /forms/:id: -> Parameter: partial = true

I do not think we need this, either we have permissions on that form -> get all information, or we do not have (e.g. just shared for submit) -> get only partial

@susnux
Copy link
Collaborator

susnux commented Apr 20, 2024

✅ POST /forms/:id:/clone

Or maybe same as creating a new and POST /forms and content: { id: 1234567 }.
I searched for similar APIs, sometimes it is also something like POST /forms?fromId=1234.

@susnux
Copy link
Collaborator

susnux commented Apr 20, 2024

But more important: Do we want logical nesting?
E.g.:

  • POST /forms/{form-id}/questions vs POST /questions
  • DELETE /forms/{form-id}/questions/{question-id} vs POST /questions/{question-id}

I personally think it makes sense for forms, as we always need to query the form to check access to question / option etc.

But I am not sure about shares, because they are also bound to forms, like:

  • POST /forms/{form-id}/shares makes sense to create a new share for that form

But we also need /shares to fetch shares for the current user. EXCEPT if we include that in our /forms endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of discussion Being discussed enhancement New feature or request php PHP related ticket technical debt Technical issue
Projects
None yet
Development

No branches or pull requests

2 participants