web services - What is the correct way of returning a file in a Rest webservice request? -
i need homecoming file in webservice. bit in uncertainty of best/correct/execpted way. (i using json).
i can:
simply homecoming file (as normal download) right mime type, etc. via http encode de file (eg: base64 or other) , send within json answer return json reply url file can found.
all 3 valid, depending on client's needs, why not create client's choice?
let's it's image/jpeg
file:
if client sent accept: image/jpeg
header, homecoming file normal download.
if client sent accept: image/jpeg
header , accept-encoding: base64
, homecoming normal download, base64 encoded.
if client sends accept: text/uri-list
header, homecoming plain text response uri image stored somewhere else.
there no standard mimetypes homecoming base64 or links within json, can utilize standard of own , create vnd mimetype, long document it.
web-services file rest
No comments:
Post a Comment