sub create_external_inv { my $headers = { Accept => "application/json", 'Content-Type' => "application/json", Authorization => "Bearer 123" }; my $url = "https://moneybird.com/api/v2/123/external_sales_invoices"; my $data = ( { external_sales_invoices => { "reference" => "M-8426", "date" => "2020-03-14", "contact_id" => 456, "details_attributes" => [ { "description" => "coffee", "price" => 2.25, "tax_rate_id" => 891 } ] } } ); my $agent = HTTP::Tiny->new; my $res = $agent->post( { url => $url, content => $data, headers => $headers } ); print Dumper $res; if ( $res->{success} ) { print "Okay!\n"; } else { print "\n\Nope...\n\n"; } } #### 'content' => 'Cannot parse URL: \'HASH(0x7fc154e1fb50)\' ', 'url' => { 'content' => { 'external_sales_invoices' => { 'reference' => 'M-8426', 'details_attributes' => [{'tax_rate_id' => '891, 'description' => 'coffee', 'price' => '2.25}], 'date' => '2020-03-14', 'contact_id' => '456 } }, 'headers' => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer 123' }, 'url' => 'https://moneybird.com/api/v2/123/external_sales_invoices' }, 'reason' => 'Internal Exception', 'success' => '', 'status' => 599, 'headers' => { 'content-type' => 'text/plain', 'content-length' => 41 } };