Uploading an image with the API POST Request

I want to upload an image with the POST request and retrieve it from database. How can I do that?

1. To which datatype can we assign the document?

2. How can we convert to image into base64?

3. How can we encode and decode? 

  Discussion posts and replies are publicly visible