in reply to Re: Asking for help with simple api post via perl
in thread Asking for help with simple api post via perl

Thanks for the quick reply. It turns out to be how $ua->credentials($user, $pwd) as encoding the credentials. When I delete the credentials line and use $url="https://$user:$pwd\@api.mysite.com/2022-01-08/enrich/upload" instead, it works. So this is what I ended up with.
#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; use Data::Dumper; my $ua = LWP::UserAgent->new(); my $user = "any_string"; my $pwd = "{secure_token}"; my $url = "https://$user:$pwd\@api.mysite.com/2022-01-08/enrich/upload +"; my $data = 'testme@mysite.com'; my $webhook = "http://mywebhook.com/"; my $content_type = "form-data"; my $response = $ua->post($url, Content_Type => $content_type, Content +=> [data => $data, webhook => $webhook] ); my $content = $response->as_string(); print ($content);