<div dir="ltr"><div>Thanks Joe!</div><div><br></div><div>As I mentioned in an earlier response, everything started to work after I installed IO::Socket::SSL and Net::SSLeay.</div><div><br></div><div>FWIW, here's my Perl5 info, generally installed with Macports (running on an ancient MacOS = 10.11.6 El Capitan):</div><div><br></div><div><span style="font-family:monospace">user@mbook:~$ which perl<br>/opt/local/bin/perl<br>user@mbook:~$ perl --version<br><br>This is perl 5, version 34, subversion 1 (v5.34.1) built for darwin-thread-multi-2level<br><br>Copyright 1987-2022, Larry Wall<br><br>Perl may be copied only under the terms of either the Artistic License or the<br>GNU General Public License, which may be found in the Perl 5 source kit.<br><br>Complete documentation for Perl, including FAQ lists, should be found on<br>this system using "man perl" or "perldoc perl".  If you have access to the<br>Internet, point your browser at <a href="http://www.perl.org/" target="_blank">http://www.perl.org/</a>, the Perl Home Page.<br><br>user@mbook:~$ </span><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Nov 20, 2022 at 12:35 PM Joseph Brenner <<a href="mailto:doomvox@gmail.com" target="_blank">doomvox@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Yes, for what it's worth, that code example works for me:<br>
<br>
perl /home/doom/End/Cave/RakuStudy/Wall/raku-study/bin/2022nov20/<a href="http://rest_api_demo.pl" rel="noreferrer" target="_blank">rest_api_demo.pl</a><br>
[<br>
  {<br>
    'possible_replacement' => [],<br>
    'assembly' => 'GRCh38',<br>
    'latest' => 'ENSG00000157764.14',<br>
    'id' => 'ENSG00000157764',<br>
    'release' => '108',<br>
    'type' => 'Gene',<br>
    'is_current' => '1',<br>
    'version' => 14,<br>
    'peptide' => undef<br>
  },<br>
  {<br>
    'assembly' => 'GRCh38',<br>
    'possible_replacement' => [],<br>
    'release' => '108',<br>
    'latest' => 'ENSG00000248378.1',<br>
    'id' => 'ENSG00000248378',<br>
    'version' => 1,<br>
    'peptide' => undef,<br>
    'type' => 'Gene',<br>
    'is_current' => '1'<br>
  }<br>
]<br>
<br>
<br>
I might suggest playing with "cpanm", aka "cpanminus"-- it's a good,<br>
no-brainer way of installing perl modules for your own use without<br>
fussing with sysadmin tasks too much.<br>
<br>
<a href="https://metacpan.org/pod/App::cpanminus" rel="noreferrer" target="_blank">https://metacpan.org/pod/App::cpanminus</a><br>
<br>
<br>
<br>
On 11/20/22, Collin Seaton <<a href="mailto:collinseaton@gmail.com" target="_blank">collinseaton@gmail.com</a>> wrote:<br>
> Hi William,<br>
> You can check your $response for more details on the failure. Specifically:<br>
><br>
> die "Failed: ", $response->{content}, "\n" unless $response->{success};<br>
><br>
> This is a guess, based on past work with Perl and web APIs, but you<br>
> probably need to install some modules to support the https protocol. From<br>
> the HTTP::Tiny docs, you'll need IO::Socket::SSL and Net::SSLeay.<br>
> <a href="https://metacpan.org/pod/HTTP::Tiny#SSL-SUPPORT" rel="noreferrer" target="_blank">https://metacpan.org/pod/HTTP::Tiny#SSL-SUPPORT</a><br>
><br>
> -collin<br>
><br>
> On Sun, Nov 20, 2022 at 7:38 AM William Michels <<a href="mailto:wjm1@caa.columbia.edu" target="_blank">wjm1@caa.columbia.edu</a>><br>
> wrote:<br>
><br>
>> Hello,<br>
>><br>
>> I'm trying to get the example Perl5 code from the bottom of this REST-API<br>
>> page to work:<br>
>><br>
>> <a href="https://rest.ensembl.org/documentation/info/archive_id_post" rel="noreferrer" target="_blank">https://rest.ensembl.org/documentation/info/archive_id_post</a><br>
>><br>
>> I can get the example curl, wget, and R code to work from the same page,<br>
>> so I know the server (<a href="https://rest.ensembl.org" rel="noreferrer" target="_blank">https://rest.ensembl.org</a>) is up and running. Below<br>
>> is the code, cut-and-pasted. I had to install the JSON module. All I get<br>
>> back is the string "Failed!" while curl, wget, and R all return actual<br>
>> data:<br>
>><br>
>><br>
>> use strict;<br>
>> use warnings;<br>
>><br>
>> use HTTP::Tiny;<br>
>><br>
>> my $http = HTTP::Tiny->new();<br>
>><br>
>> my $server = '<a href="https://rest.ensembl.org" rel="noreferrer" target="_blank">https://rest.ensembl.org</a>';<br>
>> my $ext = '/archive/id';<br>
>> my $response = $http->request('POST', $server.$ext, {<br>
>>   headers => {<br>
>>       'Content-type' => 'application/json',<br>
>>       'Accept' => 'application/json'<br>
>>   },<br>
>>   content => '{ "id" : ["ENSG00000157764", "ENSG00000248378"] }'<br>
>> });<br>
>><br>
>> die "Failed!\n" unless $response->{success};<br>
>><br>
>><br>
>> use JSON;<br>
>> use Data::Dumper;<br>
>> if(length $response->{content}) {<br>
>>   my $hash = decode_json($response->{content});<br>
>>   local $Data::Dumper::Terse = 1;<br>
>>   local $Data::Dumper::Indent = 1;<br>
>>   print Dumper $hash;<br>
>>   print "\n";<br>
>> }<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> SanFrancisco-pm mailing list<br>
>> <a href="mailto:SanFrancisco-pm@pm.org" target="_blank">SanFrancisco-pm@pm.org</a><br>
>> <a href="https://mail.pm.org/mailman/listinfo/sanfrancisco-pm" rel="noreferrer" target="_blank">https://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br>
>><br>
><br>
</blockquote></div>