Skip to content

Instantly share code, notes, and snippets.

@waltervargas
Created May 3, 2022 17:49
Show Gist options
  • Save waltervargas/9519e5ce9df8b0eb36cc0456ea5dab56 to your computer and use it in GitHub Desktop.
Save waltervargas/9519e5ce9df8b0eb36cc0456ea5dab56 to your computer and use it in GitHub Desktop.
REST request from PLSQL
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$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment