Serving my next cloud media in a basic web-app - best practices, API, & feasibility

I’d like to serve the media files — photos, videos, audio, text — stored in my next cloud data/ directory for use in a gallery style web application, just a little javascript app.

Right now media assets have the following uri:

How would I go about getting a *.jpg-ending uri?

Is there a sort of basic API for this kind of thing?

If there isn’t, how feasible is this kind of thing?

Is there something I’m missing here?