Finding the URL that will download an unstructured file within a dataset

I store programmatically-created non-dataset files (.docx, .pptx, .xslx) in a Foundry dataset. I want a user to be able to download these files from object explorer and/or workshop, so I want to make an object property that contains the URL or RID for the .docx type files.
AIP Assist suggests one of two URL formats, either:
(1) https://example.palantirfoundry.com/foundry-data-sets/api/datasets/ri.foundry.main.dataset.12345678-1234-1234-1234-123456789012/files/document.docx
OR
(2) https://<FOUNDRY_URL>/io/s3/ri.foundry.main.dataset./<file_path>/<file_name>

However, format (1) gives me a File Not Found error when used in the browser while format (2) gives me a Header Missing error. When either is a property in the ontology, they just render as a non-clickable string in object explorer, even if I try using a value format of RID Resource.

I’ve also tried just using the rid/filename.docx as an object property, and also tried to specify its property value format as RID resource, but it still renders as a string. (This strategy works with a notepad RID, but doesn’t work when I need to do RID/filename.docx).

1 Like

See https://community.palantir.com/t/how-can-i-download-an-excel-file-stored-in-a-dataset-from-a-workshop-application/621/2 for the URL format, as well as some suggestions for how to achieve download-on-click behavior.

As pointed out in that answer, this URL uses a private API endpoint and is therefore subject to change. A corresponding public API endpoint may be added at some point in the future.

Note that https://www.palantir.com/docs/foundry/api/datasets-v2-resources/files/get-file-content/ would not work for this use-case, because that endpoint requires authenticating with a token passed via the authentication HTTP header, and the browser will not automatically send that header during regular navigation such as clicking on a link.

1 Like