I am writing project which is simple web file repository. A client sends me a file with POST
:
POST /file
<binary data>
and gets hash
of the file as a response.
He can send images, documents, etc. I would like to provide him a best way to retrieve those files from the application with hashes. So he could call:
GET /file/{hash}
And retrieve binary
version of file.
Or maybe the better approach is to give him the file properties like:
{
type: "image/png"
bytes: 1024,
properties: [{
width: 100,
height: 200
}]
}
And then under URLs:
GET /file/{hash}?base64
He will get Base64 encoded file, and under
GET /file/{hash}?binary
will be binary version of file responded? Which approach is better and more RESTful?