How to get real/full path of a file from a share link?

Hi, I’m building a really small app where I share a temporary link to users via mail. I already managed to generate a temporary link using the API, and I do it by passing the real file path (ex. “/tests/test.pdf”). That was a draft and worked well. But in real life my client must give me a path to the file in some way from wordpress admin custom field (they have products, each of them will have shareable documents). Ideally, they could copy the file share link from NC and save it to the product. But then, to create a dynamic temporaty link via API to those files, I would need to obtain in some way the real path to pass from the share link. How to?

Unfortunately, I did not understand your problem. You’re probably looking for the opposite solution to what I’m writing to you now. You can simply append /download to a share such as https://cloud.server.tld./s/abcdefghijklmno like https://cloud.server.tld./s/abcdefghijklmno/download to address a shared file in Nextcloud. Maybe this information will help you.

1 Like

Mmm, in fact, I already managed doing what I was looking for. I can extract the token from the share link, then use the API to get all my shared files infos and and then search for the one with the right token. From there I’m able to get the real path and with that, I can use the API again to get a temporary link.

Still, I’m interested in what you are writing. Probably the /download url doesn’t help here, but can be useful for other uses.

Thank you