Change image at LinkshareURL without changing the URL through API


I want to programmatically (through an API) change the image located at a certain Linkshare url without changing the URL. How can I accomplish this?

Hello @burneverything1 ,
Welcome to the forum!

You can create a shared link to the bucket/prefix/object.
If you do not change the name and upload the object above the existing one - it would be updated without update of the shared URL.
For example

$ uplink cp sj://web-test/tardigrade.png sj://web-test/src/my-image.png
20.91 KiB / 20.91 KiB [--------------------------------------------------------------------------] 100.00% 7.83 KiB p/s
sj://web-test/tardigrade.png copied to sj://web-test/src/my-image.png

$ uplink share --url --not-after +1h sj://web-test/my-image.png

Now you can replace the image with some other image:

$ uplink cp sj://web-test/src/StorjDCS.png sj://web-test/src/my-image.png
36.41 KiB / 36.41 KiB [-------------------------------------------------------------------------] 100.00% 24.45 KiB p/s
sj://web-test/src/StorjDCS.png copied to sj://web-test/src/my-image.png

And the image will update on the same URL.

Amazing, I will try this. Thank you!

1 Like