Download .morph files from the Server using an EM cmd line API

I hope you are well.

I am looking for a method to download .morph files from the EasyMorph server and save them to a safe location (as backup). I am thinking of using an API to do that.
I know Python so I was wondering if you would be able to guide me on this please?
Or if you have any other better suggestions, could you please share those for me?

Thank you

The simplest option would be to use the ems-cmd command-line utility. It’s lightweight, cross-platform, and can be used from any programming language, including Python.

It comes with EasyMorph Server installation, or can be downloaded separately.

See here for details: GitHub - easymorph/server-cmd: Command line API client for EasyMorph Server

Alternatively, you can go a longer route by designing an API endpoint with a workflow that will:

  • Copy all the .morph files into a temporary directory
  • Zip them
  • Return an HTTP response that initiates downloading of the zip archive

This would be more secure and wouldn’t require any 3rd party software and would download all files at once instead of fetching them one by one.

1 Like

Hi @dgudkov ,

Thank you so much, you’re always quick to respond :slight_smile:

That’s perfect. That is exactly what I had in mind.

What additional permissions will I need to make this work? I understand I might need access to the EM server which is installed on someone’s machine. I currently do not have the server downloaded on my machine. I only have access to the server on the browser.

I think this command line API does not need the server to be downloaded on the machine of the one who is running those commands (myself) and I can connect to the server remotely. Is that correct?

Secondly, I know we can download the files one by one but is there an option to download files in bulk too? So for instance if I have about 10 files on ABC server space, and I want to download 8 out of the total 10 files, can I download those 8 files at once by specificying the id?

Thank you once again for your kind support. EM team is the best :slight_smile:

Kind regards,

Knowing the space name and the space password is enough.

That’s correct. The Server doesn’t have to be installed. The ems-cmd utility is autonomous.

No, there is no such option. You can list files using ems-cmd and then download the necessary files one by one.

1 Like

Perfect. Thank you so much :slight_smile:

Kind regards,