GRESB / api-docs

http://gresb.github.io/api-docs/
3 stars 0 forks source link

Response delete - API #16

Closed EmilTemirov closed 9 years ago

EmilTemirov commented 9 years ago

Could you please implement a delete operation for responses via API? Thanks.

amichal commented 9 years ago

Hi Emil,

Thanks for bringing this up.

We have so far specifically excluded DELETE from the public edit_assets API since a response almost always contains content you are unable to see/edit via the current API.

We anticipate that in most real world cases your user will already have a response started with values entered for many areas not currently exposed in the API. In this case you would want to list the existing response and have your user select it. If they have not yet started their GRESB response starting a new empty one for them does no harm so we allowed an API action to setup a minimal response.

If we expose a delete method on the current API we have to choose to either:

If it's OK that in most real world cases the delete will fail then we can allow newly created responses to be deleted (essentially an undo if a user accidentally created a response and then through better of it).

On Tue, Feb 17, 2015 at 1:06 PM, Emil Temirov notifications@github.com wrote:

Could you please implement a delete operation for responses via API? Thanks.

— Reply to this email directly or view it on GitHub https://github.com/GRESB/api-docs/issues/16.

EmilTemirov commented 9 years ago

API provides delete all asset data for response: http://gresb.github.io/api-docs/#show-asset-level-data Therefore, if we will be able to delete empty "responses", then we can delete and not empty responses also by executing following commands sequentially:

DELETE /api/responses/:response_id/asset_level_data
DELETE /api/responses/:response_id  
amichal commented 9 years ago

Once a real user has started filling on the non-asset parts of a response the second delete will be prevented. Does that make sense? The response is a container for more then just the asset_level_data. As an example there are answers to many other kinds of questions. Since we don't expose an API to see/edit those parts exposing an API to delete a response would only work in the case that a user has not manually entered ANY data for the response in other areas.

All that said the API endpoint DELETE /api/responses/:response_id should work on the sandbox but will soon almost always return an error once a real user has started interacting with the survey. Once that logic is worked out I'll add it to the API documentation.

On Wed, Feb 18, 2015 at 7:24 AM, Emil Temirov notifications@github.com wrote:

API provides delete all asset data from response: http://gresb.github.io/api-docs/#show-asset-level-data Therefore, if we will be able to delete empty "responses", then we can delete and not empty responses also by executing following commands sequentially:

DELETE /api/responses/:response_id/asset_level_data

DELETE /api/responses/:response_id

— Reply to this email directly or view it on GitHub https://github.com/GRESB/api-docs/issues/16#issuecomment-74855865.

EmilTemirov commented 9 years ago

Thanks! Now, I figured out what you mean. So, I think, DELETE action has no sense in API.