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

Add support for DELETE method in v1/data API #609

Closed
tsandall opened this issue Feb 12, 2018 · 1 comment
Closed

Add support for DELETE method in v1/data API #609

tsandall opened this issue Feb 12, 2018 · 1 comment

Comments

@tsandall
Copy link
Member

The OPA v1/data API supports deletion/removal of data via JSON Patch, however, in some cases, it's easier to call v1/data with DELETE instead of crafting the JSON Patch. For example:

Instead of:

PATCH /v1/data/foo

[
  {"op": "remove", "path": "bar/baz"}
]

Callers would:

DELETE /v1/data/foo/bar/baz

The implementation should be relatively straightforward:

  • Add a new v1DataDelete function to handle DELETE calls
    • Open a write txn
    • Call storage.Store#Write(remove, <path>, nil)
    • Commit txn on success (or Abort on error)
  • Register handler with the others
  • Update rest-api.md with docs on DELETE support (copying format from other sections)
@BenderScript
Copy link
Contributor

BenderScript commented Feb 12, 2018

I will take care of this one. I have interest on having it working (;-)

This was referenced Feb 13, 2018
tsandall pushed a commit that referenced this issue Feb 13, 2018
- Support for DELETE(ing) /data resources
- Deleting non existing resources returns 404
- Deleting a resources and then GETting it returns 200
  with empty body
- GETting resources that were not explicitly deleted before
  will return 200OK with body {"result": {}}
- Fixes #609
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants