How to create a file with a rendition in OCP

Troy Crampton
Troy Crampton Member
edited November 22 in Thrust Services #1

When attempting to create a file instance I'm getting "Failed to relate object". I've been through all the docs and tutorial and I've tried several different options to no avail. Any tips would be appreciated:

Here are the details:

POST cms_url/instances/file/emb_document
{
"parent_folder_id": "0d1d9571-dac0-4d43-8e36-b144ea6507bf",
"name": "chart image for 11111",
"description": "patient chart image",
"version_label": ["first"],
"properties":{
"doc_number":"10000",
"practice":"LDY",
"account_number":"11111",
"service_date":"2024-11-20",
"page_count":1,
"division":"18",
"file_name":"chart.tiff"
},
"renditions": [{
"name":"patient chart","rendition_type":"primary",
"blob_id":"css_url/v3/files/af98eb99-0642-4616-b3b5-fca7362a481a/stream",
"mime_type": "image/tiff",
"content_size": 2649952
}]}

The response is 500:
{
"path": "cms_url/instances/file/emb_document",
"title": "Internal Server Error",
"status": 500,
"details": "Failed to relate object. ID=e9a19832-2e75-43ad-959b-24fe20bafe1a",
"incident": "0cbf7ce5-79d7-4232-80c2-b04417e08055"
}

I also tried:
"blob_id":"af98eb99-0642-4616-b3b5-fca7362a481a",

but same response.
I am able to download the file so it is there.
And I did validate the parent folder does exist (within the tenant root). I also tried using the subscription and tenant root as parent folders but same response.

BTW, this is the upload response
POST css_url/v3/files/fromStream?tenant_id=XXXX

response:
{
"authZCallback": {},
"originalFileName": "redacted.tiff",
"mimeType": "image/tiff",
"numberOfParts": 1,
"partSizeInBytes": 134217728,
"lastPartSizeInBytes": 2649952,
"parts": [
{
"id": 0,
"sizeInBytes": 2649952,
"uploadState": "complete"
}
],
"id": "af98eb99-0642-4616-b3b5-fca7362a481a",
"uploadState": "complete",
"scanState": "partsPassedFullPassed",
"lastScanDate": "2024-11-21T22:15:22.328528683Z",
"size": 2649952,
"fileProperties": {
"sha-256": "E8014116E5EA8A15FF54B1EDC25EACDEB32AD0C47E91DE88A01A0861989284DC"
},
"createDate": "2024-11-21T22:15:15.478Z",
"lastUpdateDate": "2024-11-21T22:15:15.478Z"
}

It is successful if I don't include the "renditions" array. But if I try adding a rendition with POST /instances/file/{type}/{id}/contents I get the same error.

Thanks in advance

Answers

  • EDIT:

    If I upload the file with the CSS V2 API it returns a blobId. If I use that with the request above it succeeds.

    So I guess the CMS isn't supporting CSS V3 files?