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

Allow editing of bucket and key caches via plain/text #117

Open
dmitrizagidulin opened this issue Dec 15, 2015 · 4 comments
Open

Allow editing of bucket and key caches via plain/text #117

dmitrizagidulin opened this issue Dec 15, 2015 · 4 comments
Assignees

Comments

@dmitrizagidulin
Copy link
Contributor

We already have the ability to edit the bucket and key caches by submitting JSON lists. For example:

curl -XPUT -H 'Content-Type: application/json' localhost:9000/explore/clusters/localdev/bucket_types/default/buckets \
 -d '{"buckets": ["mybucket", "mybucket2", "mybucket3"]}'

Now we need the ability to edit those caches using plain text. Like so:

curl -XPUT -H 'Content-Type: plain/text' localhost:9000/explore/clusters/localdev/bucket_types/default/buckets \
-d 'mybucket
mybucket2
mybucket3'
@drewkerrigan
Copy link
Contributor

Ready for review. Usage:

curl -XDELETE localhost:9000/explore/clusters/localdev/bucket_types/default/buckets
curl -XPUT -H 'Content-Type: plain/text' localhost:9000/explore/clusters/localdev/bucket_types/default/buckets --data-binary @buckets.txt
curl localhost:9000/explore/clusters/localdev/bucket_types/default/buckets
{"buckets":{"total":4,"count":4,"created":"2015-12-15 17:03:47","buckets":["mybucketdrew","mybucket2","mybucket1","mybucket"]},"links":{"self":"/explore/clusters/localdev/bucket_types/default/buckets"}}

curl -XDELETE localhost:9000/explore/clusters/localdev/bucket_types/default/buckets/mybucket/keys
curl -XPUT -H 'Content-Type: plain/text' localhost:9000/explore/clusters/localdev/bucket_types/default/buckets/mybucket/keys --data-binary @keys.txt
curl localhost:9000/explore/clusters/localdev/bucket_types/default/buckets/mybucket/keys
{"keys":{"total":4,"count":4,"created":"2015-12-15 17:10:00","keys":["mykey4","mykey3","mykey2","mykey1"]},"links":{"self":"/explore/clusters/localdev/bucket_types/default/buckets/mybucket/keys"}}

@dmitrizagidulin
Copy link
Contributor Author

Is there a way to also GET the list in plain text format? So that the client doesn't have to parse the JSON before putting it into an edit box? Something like:

curl localhost:9000/explore/clusters/localdev/bucket_types/default/buckets -H 'Accept: plain/text'

@dmitrizagidulin
Copy link
Contributor Author

One other feature request, per our conversation in chat:

Implement support for ?rows=all, so that the client doesn't have to first do a JSON response to see how many rows there are, before requesting the whole file.

(Alternatively -- I don't know what's easier or more correct semantically -- you can assume that if somebody is passing in an Accept: plain/text header, they want all the rows.)

@dmitrizagidulin
Copy link
Contributor Author

And lastly (so it doesn't get lost in chat) - would it be difficult to change the PUT to a POST, for editing cached lists? (since the call has append semantics).

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