How external applications can run EasyMorph workflows

There are 2 ways how external applications can run EasyMorph workflows:

Run EasyMorph Desktop in the command line mode

See the documentation for the command line syntax: https://help.easymorph.com/doku.php?id=command_line

Pros:

  • Easy setup
  • Can assign project parameters
  • Can run multiple instances of the same project at the same time
  • No EasyMorph Server required

Cons:

  • Can’t run a workflow on another computer
  • Can’t run workflows asynchronously
  • Requires Windows
  • No tight integration possible (e.g. showing task status in real time)

Run EasyMorph Server task via ems-cmd or .NET SDK

The .NET SDK is an open-source library that can be used in .NET (C#, etc.) application directly to run EM Server tasks and list/upload/download files. It’s source code is available on GitHub here: https://github.com/easymorph/server-sdk.

The ems-cmd utility is simply a command line utility that is basically a thin wrapper for the .NET SDK and runs in the command-line mode. Since it’s a .NET Core application, it can be compiled and used on non-Windows machines (e.g. Linux). It’s source code and the latest version is available here: https://github.com/easymorph/server-cmd

Pros:

  • Can run EM workflows on another computer
  • Can assign project parameters
  • Allows tight real-time integration with .NET applications
  • Can be used on non-Windows machines
  • Includes means for uploading/downloading files to/from EM Server
  • Can run workflows under a different user account than the calling app
  • Can run workflows in both synchronous and asynchronous modes

Cons:

  • Requires EM Server license
  • Can run only one instance of a task at a time. I.e. if a task is already running it can’t be launched again. (This limitation will be lifted in version 5 to be released by the end of the year). Partially, this can be mitigated by having a pool of identical tasks and triggering any task that is not running.

Run EasyMorph Server task via REST API

The .NET SDK described above is effectively an open-source client for the REST API of EasyMorph Server. Any application can trigger tasks and upload/download files to/from Server using the REST API. The source code of the SDK is a reference use of the SDK and is supposed to be self-explanatory.

Hello,

I’m trying the EM SDK but I think that the readme.md in the GitHub is a little bit old, for example the .CloseSessionAsync() doesn’t exist in the MorphServerApiClient, or in the following example:
var spaces = await apiClient.GetSpacesListAsync(cancellationToken);
foreach(space in spaces){
///…
}

the SpacesEnumerationList class doesn’t contain a public definition for “GetEnumerator” (you’ve to use spaces.Items in the foreach sentence).

Is there an update guide?
Or maybe some swagger about the API?

Hello Andrea,

You’re correct, the docs are outdated. We’ll update them shortly. I’ll let you know when it’s ready.

Thanks Dmitry,

I’ve to ask you/the community another thing about external applications:
we’ve got alot of Microsoft Access that, given some inputs, elaborate data and returns the result (usually an Excel or a query view). I think that all of these Access query can be re-done better in EM, but I’m not so sure about how to manage the “input phase”.
Usually inputs are texts and in some rare case there are some excel input file.
It’s good to create .NET forms that call EM through API, or is better to se the CMD, or is there other ways to manage this that I don’t understand/know?

The answer would depend on how the “input phase” works. If it’s one-time input of multiple data values before a workflow begins, then it can be done using parameters in an EasyMorph Server task.

If there multiple “input” forms at various points of a workflow, then yes, something like a .NET form application would be needed. The application can either call EM through API, or use the “ems-cmd” utility, or run EasyMorph Desktop in the command line mode.

@AndreaM, the documentation on SDK has been updated.

Thanks Dmitry, I’ll give it a try asap.
In these days I read the EM Server Docs and I think that, if I understand correctly, I’ve only to create a correct space with Lock Project task access mode and full access as file access mode and I can manage everything from there, without the need to create external C applications.

I see that, as a login, the AD is available in the Enterprise edition only, for the Team ones I can send username/password throught POST (to centralize the login in my SSO)?

If you want to use a Server task, you can either use the “EasyMorph Server Command” action in EasyMorph or use the ems-cmd utility to trigger tasks from the command line.

Logging in via a POST request would be non-trivial as the Server doesn’t receive the password from the login form in the browser. Instead, the Server performs a more secure workflow that includes round-trip hashing and salting.

All clear.

I just finished trying to allow a user to enter in a EM Space, launch a task (with parameters required at the startup) and as a result it’ll generate an output file that is downloadable in the “files” tab: perfect.

If I can suggest two improvements:

  • It could be useful that we can force a file download when the task is finished (maybe it could be a new action);
  • It could be great if the errors, that can occurs in a task run, appear just below the task row. A kind of “log”, with only the “error” lines, of the last run;

You can send the user an email with a download link at the end of the workflow. You can see the URL when you hover mouse over the file name in tab "Files". It has the following format:

http(s)://<host>:port/space/<spacename>/files/get/<path to file>/<file name>

Nice idea, thanks!