Hi Alan, I know it's quite an old tread but a sample code for this would be great. I'm just facing exactly the scenario you descibed: "it looks like you would need to create a script on your public website that receives a request from visitors for a document, then uses the API to retrieve the document and serve it for downloading"
Sorry for the delayed response! I hope you got this resolved, but just in case you or someone else needs it, here's some more information on this.
The first thing you'll want to do is connect to the REST API. A good starting place is the sample code for CRUD operations. The Authentication section will get you connected, then you can use the Getting A Record section for retrieving a single record. If you want multiple records, the sample code for Filter a List of Records should help.
If you need more help, feel free to reply or send me a private message!
Retrieving data ...