Download pdf of a filled form through command line

Hi,

I’m trying to save a pdf copy of a submitted webform using command line.
I managed to get the correct url by using:

curl GET https://{kpi}/api/v2/assets/{uuid}/data/{id}/enketo/view/ -H "Authorization: Token #####"

which returns something of the form

{"url":"{enketo_url}","version_uid":"########"}

copying and pasting {enketo_url} into the browser gives me the filled webform as desired.

Then through command line I tried :

curl GET {enketo_url} 

But instead of the filled webform, I get what looks like an empty enketo template.
EDIT: actually its the html of the enketo loading page - blue pulsing circle, rather than a blank form.

If I refresh the browser after trying through command line, I get a loading error as if the permission was revoked:

Loading Error
Error occured during the loading of this form.

Please contact support@kobotoolbox.org with the link to this page and the error message below:

Record not present. It may have expired.

and rerunning the first command “curl get …/enketo/view … etc” will give me a different value for {enketo_url}.
So I guess its to do with the authorisation for enketo not matching the one for kobo… although I’m not sure why it works in the browser on the first try… maybe some cookie that gets deleted when the command line tries?
I looked into setting up an enketo server to try to get some credentials that way, but reading through the instructions it seems (way) beyond my skill level.

Any suggestions very much appreciated!

best wishes

@ralphthompson, it could be a timeout error message.

thanks for the suggestion!
The link does seem to expire very quickly, it stops working after around 30s. But I get the same result even if I pipe the result of the url request into the next GET command, so I don’t think its that.

I tried putting the API request into postman and looking at the preview, and it is showing the enketo loading screen (pulsing blue circle) but it never loads the script to generate the webform - so maybe the issue that the API / curl are not passing me the results of the script?..