call rest api from postgresql

Solutions on MaxInterview for call rest api from postgresql by the best coders in the world

showing results for - "call rest api from postgresql"
Emilie
01 Feb 2020
1CREATE OR REPLACE FUNCTION restful.put(auri character varying, ajson_text text)
2 RETURNS text
3 LANGUAGE plperlu
4 SECURITY DEFINER
5AS $function$
6  use REST::Client;  
7  use Encode qw(encode);
8  my $client = REST::Client->new();    
9  $client->getUseragent()->proxy( 'https', 'http://some-proxy/' ); # use for proxy authentication
10  $client->addHeader('Content-Type', 'application/json');          # headers
11  $client->POST( $_[0], encode('UTF-8', $_[1]));                   # encoding
12  return $client->responseContent();  
13$function$
14