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

API /forms #1

Closed
dkobia opened this issue Oct 25, 2012 · 1 comment
Closed

API /forms #1

dkobia opened this issue Oct 25, 2012 · 1 comment
Assignees

Comments

@dkobia
Copy link

dkobia commented Oct 25, 2012

@rjmackay
Copy link
Contributor

rjmackay commented Nov 6, 2012

I've been playing a bit more with building this out.
Just thinking about updates to

How should we handle missing attributes / groups?

  1. I create a form with two groups: group 1 and group 2.
    { "name":"test", "description":"Testing form edit", "type":"report", "groups":[ {"label":"Group 1"}, {"label":"Group 2"} ] }
  2. I PUT /posts/1 an update to that form which only contains 'Group 1'
    Should group 1 get deleted? or do we just ignore the fact its missing?
    Any sensible way to confirm that a group is deleted?
    { "name":"test", "description":"Testing form edit", "type":"report", "groups":[ {"id": "1","label":"Group 1"} ] }

PUT is normally supposed to be idempotent
(http://en.wikipedia.org/wiki/HTTP_PUT#Idempotent_methods_and_web_applications) which make using PUT to create new groups a little more complicated

  1. Create a form
    { "name":"test", "description":"Testing form edit", "type":"report", "groups":[ {"label":"Group 1"}, {"label":"Group 2"} ] }
  2. Send a PUT /posts/1 to update the form with the same groups .. no issues
    { "name":"test", "description":"Testing form edit", "type":"report", "groups":[ {"id": "1","label":"Group 1"}, {"id": "2","label":"Group 2"} ] }
  3. Send a PUT to update the form to add group 3
    This would add group 3, and return JSON with the new group ID.. however if you sent this request multiple times (ie. due to connection issues) you would end up with several "Group 3"s being created.
    Would it make sense to only allow adding new groups/attributes using a POST to /posts/1/groups ?
    instead of via PUT to /posts/1
    { "name":"test", "description":"Testing form edit", "type":"report", "groups":[ {"id": "1","label":"Group 1"}, {"id": "2","label":"Group 2"}, {"label":"Group 3"} ] }

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

No branches or pull requests

2 participants