Help with template create,

I am digging through the rest api, and trying to create a template which I had previously exported from the web interface.

I am using the script below,

https://gist.github.com/3d5d60a777042e531da8

but I always get...