Enketo View form as PDF - Attachment unauthorized

Hi,

I have try to using the enketo /api/v2/instance/view/pdf api route in my own self instance.
My post data seems to be fine, with form_id, instance, instance_id and instance_attachments like :

'instance_attachments[<FILENAME>.jpg]': ' <FILE_URL...>.jpg', 
'instance_attachments[<FILENAME>.jpg]': '<FILE_URL...>.jpg', 
'instance_attachments[<FILENAME>.jpg]': '<FILE_URL...>.jpg'

If my project is shared publicly, all works find, I get the PDF with data and images.
However, if my project is not shared, enketo asks Kobocat to get attachments (without any KC token), and Kobocat throws an unauthorized message. Thus, the PDF is generated with data but without images.

My first question :
Is this normal behavior ?

If i look the log (and understand correctly), I can see that :
Enketo get the data with an internal request - It doesn’t need a token ?
My attachments FILE_URL are a “kobocat media_file url” like :
https://kc.humanitarianresponse.info/media/medium?media_file=[USERNAME]%2Fattachments%2F[formhub/uuid]%2F[FILENAME].png

My second question :
Am I wrong in the URL of my attachments? Is there a way to get an ‘internal’ url for Enketo ?

Or maybe I’m not using the Enketo API correctly?

Thank you,
Jonathan

Welcome back to the community, @jdugh! Do you mean you wish to view your data (submission) as PDF?

Hi @Kal_Lam !

Yes, I am trying to create a python script to export all submissions of a projects as PDF.