Foreman v1.6 API -- what am I doing wrong?

I tried doing the following from a Perl script:

$client -> POST('/api/v2/smart_proxies/1/import_puppetclasses',$headers);

also tried coding it thusly

#decode the response in perl a type
$client -> POST('/api/v2/smart_proxies/:1/import_puppetclasses',$headers);

Got the same response with both of them
$VAR1 = '500 Not a SCALAR reference
';

so… what's the right way?