call rest api from postgresql code example
Example: call rest api from postgresql
CREATE OR REPLACE FUNCTION restful.put(auri character varying, ajson_text text)
RETURNS text
LANGUAGE plperlu
SECURITY DEFINER
AS $function$
use REST::Client;
use Encode qw(encode);
my $client = REST::Client->new();
$client->getUseragent()->proxy( 'https', 'http://some-proxy/' ); # use for proxy authentication
$client->addHeader('Content-Type', 'application/json'); # headers
$client->POST( $_[0], encode('UTF-8', $_[1])); # encoding
return $client->responseContent();
$function$