I have a file in alfresco and I need to download it via command line.
I have share link for that file, but it leads to file page in alfresco, not the file itself.
Also I have link to file which I copied from download button. But this link only works in browser where I logged in alfresco.
So neither of those links works with curl or wget. How can I make the second link public or how can I log into alfresco via command line? Or maybe I could follow the first link and then somehow simulate download button press?
I tried to pass username and password as curl/wget argument, but it didn't work.
I also tried to use curl with cookies, but that didn't work and I don't like to use cookies, because the token will expire
You could use REST API for download content of node. Look on https://api-explorer.alfresco.com/api-explorer/#/nodes/getNodeContent. So in curl your request could look like this:
curl --location 'https://<your_server>/alfresco/api/-default-/public/alfresco/versions/1/nodes/<nodeID>/content?attachment=true' \
--header 'Authorization: Basic <base64 encoded login:password>'
Just add name or ip of your server, nodeID (only GUID, it could looks like this 55e5b5f4-0555-49a7-869a-6b3937b9699b, you can get it from URL in document detail) and base64 encoded string "login:password". This is for basic auth.