Closed Chartman123 closed 2 months ago
❓ 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
✅ 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
.
But more important: Do we want logical nesting? E.g.:
/forms/{form-id}/questions
vs POST /questions
/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:
/forms/{form-id}/shares
makes sense to create a new share for that formBut we also need /shares
to fetch shares for the current user. EXCEPT if we include that in our /forms
endpoint.
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.
What about having both? /shares
for querying the user's shares and /forms/{form-id}/shares
to manage the shares of a form?
What about having both? /shares for querying the user's shares and /forms/{form-id}/shares to manage the shares of a form?
Would work for me :)
I've updated the tables with the proposed new routes :)
Do we want to split our API requests and deliver only the forms when you query /forms
and only get the /forms/:form-id:/questions
when you do another query? We could deliver the URI for the questions in the forms response then... But this would of course be a bigger change then...
Based on the comment by @susnux, here's the proposal on how to reorganize our API endpoints:
Forms endpoints
/forms
/forms[?type=owned]
/shared_forms
/forms?type=shared
/form
/forms
/form/:id:
/forms/:form-id:
/partial_form/:hash:
/forms/0?hash=:form-hash:
/form/clone/:id:
/forms?fromId=:form-id:
/form/update
/forms/:form-id:
/form/transfer
/form/:id:
/forms/:form-id:
/form/link/:fileformat:
/form/unlink
Questions endpoints
/forms/:form-id:/questions
/forms/:form-id:/questions/:question-id:
/question
/forms/:form-id:/questions
/question
/forms/:form-id:/questions/:question-id:
/question/reorder
/forms/:form-id:/questions
/question/clone/:id:
/forms/:form-id:/questions/:question-id:/clone
/question/:id:
/forms/:form-id:/questions/:question-id:
Options endpoints
/forms/:form-id:/questions/:question-id:/options
/forms/:form-id:/questions/:question-id:/options/:option-id:
/option
/forms/:form-id:/questions/:question-id:/options
/option/update
/forms/:form-id:/questions/:question-id:/options/:option-id:
/forms/:form-id:/questions/:question-id:/options
/forms/:form-id:/questions/:question-id:/options/:option-id:/clone
/option/:id:
/forms/:form-id:/questions/:question-id:/options/:option-id:
Sharing endpoints
/shares
/forms/:form-id:/shares
/forms/:form-id:/shares/:share-id:
/share
/forms/:form-id:/shares
/share/update
/forms/:form-id:/shares/:share-id:
/share/:id:
/forms/:form-id:/shares/:id:
Submission endpoints
/submissions/:formhash: | ✅ GET
/forms/:form-id:/submissions`/forms/:form-id:/submissions/:submission-id:
/submissions/export/:formhash:?:fileformat:
/forms/:form-id:/submissions?fileFormat=:file-format:
/submissions/export
/forms/:form-id:/submissions/export
/submission/insert
/forms/:form-id:/submissions
/forms/:form-id:/submissions/:id:
/submissions/:formid:
/forms/:form-id:/submissions
/submission/:id:
/forms/:form-id:/submissions/:submission-id:
/uploadFiles/:form-id:/:question-id:
/forms/:form-id:/submissions/files/:question-id: