updated rest.php with new export() function