If you look at the Ditto snippet code (parameter processing visible in the manager, not the included PHP files), you’ll see that some parameters, including filters, are turned into quite complex arrays. I haven’t tried it, but it may well be that you have to emulate this to run the snippet through the API.
Certainly in a Ditto config file you have to feed in parameters such as
&orderBy as an array such as
$orderBy = array('parsed'=>array(), 'custom'=>array(), 'unparsed'=>'pkDate DESC, menuindex DESC'); and not as the string you would put in a document, so you could test out whether you need such complications by adding
$orderBy = ’createdon ASC’ then
$orderBy = ’createdon DESC’ to your call, just to see if it works, before diving into the snippet code, if it doesn’t.

KP