How to load raw data from mediaSet with an osdk client

Hello,

I have an osdk client that can load objects from my ontology. The objects have a mediaReference field. The mediaReference has the following structure:

{
    "mimeType": "application/pdf",
    "reference": {
        "type": "mediaSetViewItem",
        "mediaSetViewItem": {
            "mediaSetRid": "ri.mio.main.media-set.4481bead-68b2-41a1-9457-fb0dccae869e",
            "mediaSetViewRid": "ri.mio.main.view.1ed1751c-c755-40bb-ad23-94cb2bfc1430",
            "mediaItemRid": "ri.mio.main.media-item.19b139cd-83b3-45bc-9cc5-56682a3cb900"
        }
    }
}

The mediaSet in my case is pointing to a pdf.

To my knowledge, there is currently no way to load the raw pdf data from the mediaSet using the osdk.

The work-around I have used in the past was to hit the following endpoint:
api/v2/mediasets/${mediaSetRid}/items/${mediaItemRid}?preview=true

Which used to return raw pdf data, but recently the endpoint has been updated and now returns a json object with the following structure:

{
    "viewRid": "ri.mio.main.view.1ed1751c-c755-40bb-ad23-94cb2bfc1430",
    "path": "89b21871-ccf4-4271-97e0-33788e3541b2.pdf",
    "logicalTimestamp": "1722996827653669",
    "attribution": {
        "creatorId": "986f6d53-0128-4583-bacd-df6e11133f71",
        "creationTimestamp": "2024-08-07T02:29:34.713058456Z"
    }
}

This change is now breaking my application as I can no longer load/view pdfs.

I can not find much documentation regarding loading mediaSet data, so Iā€™m reaching out to the community.

If anyone knows how to load mediaSet data from an osdk client or through endpoints, the help would be much appreciated.

Thanks,
Conner.

Hi Conner,

The endpoint has recently been changed such that you will need to add /content to retrieve the bytes of the file:

api/v2/mediasets/${mediaSetRid}/items/${mediaItemRid}/content

Since these endpoints are now available in public beta, we expect them to remain consistent moving forward.

The docs for these endpoints are now available here: https://www.palantir.com/docs/foundry/api/general/overview

1 Like