Solved

Using file API in Card Lists


Userlevel 5
Badge +20

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?

 

 

 

icon

Best answer by Vincent Doppenberg 31 May 2024, 15:01

View original

3 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?

Reply