Wrapping command-line applications

It seems that being able to write custom scripts would allow us to wrap any application with a CLI interface or api as a dreamfactory endpoint; e.g. wrapping Sharepoint API calls and publishing it as a dreamfactory service or wrapping ArcMap’s python API in Node scripts and getting parameters from webservice calls for on-demand geoprocessing. In theory, any application that could be called from one of the languages dreamfactory supports could be called via the API.

Are there any examples of this?


Unfortunetly we don’t provide many Server Side Scripting examples. But, @zerox12 below created a Github repo to collect them! So if you create some, please do post there…or, you may find something similar to what you are looking for.


1 Like

Thanks! That’s the kind of thing I was looking for.

Is this a place to put “production-ready” wrappers or just samples? The readme is not clear on this point.


1 Like

Hey @jraiche,

Thanks for the feedback. We are planning to put some more love in it, but need the communities help! We’d like to see both, “production-ready” AND samples. :thumbsup:

Can you clarify what you’d like to see from wrappers?


Wrappers is my word; maybe there’s a better one. I mean a CLI call like:

SpatialJoin_analysis (target_features, join_features, out_feature_class, {join_operation}, {join_type}, {field_mapping}, {match_option}, {search_radius}, {distance_field_name})

[arcpy spatial join code]

Could be “wrapped” so that it could be used from an API with a series of required and optional parameters.

In php, you’d do something like:

$result = ['result' => (shell_exec(python -c "import arcpy; arcpy.SpatialJoin_analysis($var1, $var2, $var3, '$var4')"))];
return $result;

Obviously, this is a silly example because DF now supports python, but that’s the idea.

Creating a wrapper would involve wrapping all or a subset of the commandline features of an application as a dreamfactory endpoint and providing a swagger file. Of course, to use the wrapper you’d have to have the target application installed on the machine or provide configuration for the endpoint.

Given some samples, people could “wrap” any local application with a CLI. These could go into a library, much like the current DF connections.

Does this seem like a reasonable undertaking?

1 Like