Parse Remote API Output (GPL)????


I’m hoping someone can shed some light on how to “consistently” parse the output of a remote api call.

*** I currently am working on a PHP frontend to webmin/virtualmin which includes a limited feature set and customized interface for my customers. ***

As I was reading the documentation on this, it appears that all output is in plain text.

However, there appears to be no easy way to actually parse content into a name => value pair or the like.



This command responds with something like:

Domain Username Description myuser my description

Exit status: 0

Now, if all I wanted to do was simply output the results directly to screen this wouldn’t be an issue.

However, I would like to parse the content of this output into a nicely formatted HTML table for instance.

There appears to be no common delimiter when parsing the output which makes this from what I’ve tried thus far either very difficult or nearly impossible.

*** Honestly, if I had designed this API, I would have implemented some level of standard output such as XML, JSON, or a combination of the two so that parsing the output would be more simple, and consistent amongst the commands. ***

Forgive me if I’m missing something here, and no offense intended for either Jamie or Joe on this, just giving my thoughts on the topic.

Hope someone can shed some light on an easy way to deal with this.

Best Regards,

Hi Peter,

If you want a format that is more easily parsed, you need to use the multiline flag to list-domains, with a URL like :


All the list-* API functions accept this same flag. Also, if you just want to get the domain names, you can use the name-only flag instead.

XML or JSON output is not available yet, but is on my TODO list.

Thanks Jamie!

It’s good to know that you do plan on this level of support in the future.

Admittingly I am still messing around with the API commands and this morning did notice the two mentioned commands.

I suppose in the meantime I will see what I can do with it and report back any findings.

My original post reflected my preferences which seems like common place in most API’s these days.

Thanks again for taking a few moments to address my concern!

As always, your apps rock!

Best Regards,