Skip to main content
Solved

Using file API in Card Lists

  • 31 May 2024
  • 5 replies
  • 84 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?

 

 

 

5 replies

Userlevel 6
Badge +4

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.

Userlevel 5
Badge +20

Hi Vincent,

Sure this helps. I will try this straight away.

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

 

Userlevel 7
Badge +23

Well @Harm Horstman, did it work? 😄

If so, could you give us a sneak peak?

Userlevel 5
Badge +20

Hi @Mark Jongeling

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


Possibilities are now almost endless

 

 

 

Userlevel 5
Badge +20

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/[meta_source]/[appl_id]/document([doc_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?

[appl_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?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reply