janelia-flyem / dvid

Distributed, Versioned, Image-oriented Dataservice
http://dvid.io
Other
196 stars 33 forks source link

API for getting values of a list of keys in batch #260

Closed tingzhao closed 5 years ago

tingzhao commented 6 years ago

The API can take a json array of keys and return a json array of values in the same order.

DocSavage commented 6 years ago

Is this keyvalue data type?

tingzhao commented 6 years ago

Yes.

stuarteberg commented 6 years ago

Request: Allow clients to specify the return format to be either json or tar:

GET http://{server}/api/node/{uuid}/{instance}/batch?format=tar

DocSavage commented 5 years ago

Added GET /keyvalues with optional ?jsontar=true query string. Returning JSON is problematic due to the binary values. We'd have to agree on how to encode the values. Instead, I support either protobuf3 (similar to the POST /keyvalues) or JSON array to specify keys of interest with a tarfile return (use jsontar query string).

stuarteberg commented 5 years ago

Returning JSON is problematic due to the binary values. We'd have to agree on how to encode the values.

If the user is requesting JSON results, couldn't you just assume that the values are JSON strings, parse them, and them load them into a JSON array? If any value turns out not to be JSON-parseable, you could return an error.