Skip to main content
Solved

Using file API in Card Lists

  • 31 May 2024
  • 6 replies
  • 99 views

We would like to make a little more advanced cardlist, that can shows multiple files from a child table.

Something like this:
 

 

I know how the html should like and have seen that indicium can deliver the images by file_id.

e.g.

<img src="https://..../entity_document(ent_id=11111,doc_id=999999)/STT.download_doc_url(file_id='??????????????')?$size=100">

The only question I have, is how to determine the file_id of a saved files? 

Would it be possible anyways, or a another approach required?

 

 

 

Hello Harm,

The file_id parameter is an optional parameter that is only used for browser caching purposes. When the file_id is provided, Indicium will include a header in the response that instructs the browser to cache the response for that URL. When the file_id is not included (or file_id=null), the URL is not specific enough to allow the browser to cache it, but the request will work just fine.

You can only obtain the file_id by sending a request for the subject and including an $eager querystring parameter with a comma-separated list of file columns for which you want a file_id. So in your example, if you’d send this request:

GET
https://..../entity_document(ent_id=11111,doc_id=999999)?$eager=doc_url

You would see the download URL in the response with the file_id included.

https://..../entity_document(ent_id=11111,doc_id=999999)/STT.download_doc_url(file_id='123456')

Now I can imagine that this is not an option for you, so you could just do this instead:

https://..../entity_document(ent_id=11111,doc_id=999999)/STT.download_doc_url()

I hope that helps.


Hi Vincent,

Sure this helps. I will try this straight away.

I assume it will work, you make us very happy with this! 

 


Well @Harm Horstman, did it work? 😄

If so, could you give us a sneak peak?


Hi @Mark Jongeling

This one example of how a card list looks like in our application


Possibilities are now almost endless

 

 

 


Hi @Vincent Doppenberg

As you can see, we are now able to make use of the file API.

This  does the trick for us:

<img data-testid="event_image" alt="Original Url" src="/indicium/umeta_source]/eappl_id]/document(ndoc_id])/STT.download_document_url?$size=100">

To let it work in any environment compose url’s we need to replace the meta_source placeholder (iam or sf) dynamically. 

Any idea how to achieve this?

tappl_id] is already replaced with the result of SESSION_CONTEXT(N'tsf_appl_id')

To get the current meta source, such a session variable is not available. Am I right?

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Hi @Vincent Doppenberg

I tried to use the new deep link syntax for this, like below. 

<a href="/universal/#application=:' + CAST(SESSION_CONTEXT(N'tsf_appl_id') AS VARCHAR(10)) + '/document(tdoc_id])/STT.download_document_url">Open...</a>

The URL in the link looks good, but it does not work, a new browser tab opens and the document is not downloaded.

Should it work, did I miss something? 

 


Reply