[Techincal] Download TF files directly to server?

Hello Everyone,

Is it possible to download purchased files directly to my remote linux server?

My internet connection is slow & doing this would save time re-uploading a large file.

Does anyone have insight into doing this? (wget/curl/etc)

using the api you can get your purchase items in a list using this which gives you the id of the purchases.

With your ID’s in an array, use this to iterate through the ID’s downloading each item to a location of your choice using curl

1 Like

Thanks Gareth, using the API worked perfectly.

I’m having a bit of trouble downloading the file from the Amazon S3 server however (empty files - no real transfer). Do you have any experience with this?

are you authenticating, so you have the rights to download the item? my knowledge isn’t that great unfortunately but maybe @dtbaker can advise?

2 Likes

Yes,

I use this to grab the access token :

curl -X POST -d "grant_type=authorization_code&code=[CODE]&client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]" https://api.envato.com/token

I use this to output the S3 Amazon download link:

curl -H "Authorization: Bearer [Access Token]" https://api.envato.com/v3/market/buyer/download?item_id=XXXXXX

However this doesn’t truly download the files hosted on Envato’s Amazon servers:

curl -O [Amazon S3 Link with Access Keys Details]

Which outputs an empty file.

Mind you, I’m doing this from the command line but got similar results using a PHP file similar to your StackOverflow link.

Maybe Amazon has it’s own API for downloading remotely?

1 Like

Hey @araphiel,

Are you downloading a WordPress theme?

Do the curl request with the purchase_code like this:

curl -H "Authorization: Bearer [Access Token]" "https://api.envato.com/v3/market/buyer/download?purchase_code=11111111111-1111111-11111-11111111" -o file.json

Then dump the contents of file.json and they’ll look like this:

{
  "download_url": "https://s3.amazonaws.com/marketplace-downloads.envato.com/files/1111/theme_WP_1.1.0.zip?AWSAccessKeyId=AKIAJYG",
  "wordpress_theme": "https://s3.amazonaws.com/marketplace-downloads.envato.com/files/1111/theme-1.1.0.zip?AWSAccessKeyId=AKIAJYG5"
}

IMPORTANT: if you see a few \u0026 in the URL you have to replace that with & for curl to work, e.g.: change J6X7Z3M6Q\u0026Expires=147 to J6X7Z3M6Q&Expires=147

Grab that “wordpress_theme” url and download that with curl:

curl "https://s3.amazonaws.com/marketplace-downloads.envato.com/files/1111/theme-1.1.0.zip?AWSAccessKeyId=AKIAJYG5" -o themefile.zip

Then you’ll have themefile.zip on your server.

1 Like

There you go

1 Like

It turns out the \u0026 unicode was the issue - that made all the difference.

Thanks for taking the time to take a look @dtbaker !

@dtbaker
can we have some simple commands or script that i use to download my files from codecaynon or themeforest direct into my server (hosting server) via SSH

thanks

Old topic