Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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$
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #call #rest #api #postgresql
ADD COMMENT
Topic
Name
7+2 =