Fixes vm post creation bug

Introduced with pull request c8532d8020d9fc57a8bf30431a10b199f1d7fe9b
We must cast api parameter to string otherwise it fails and exit process.