http://qs1969.pair.com?node_id=800352

hesco has asked for the wisdom of the Perl Monks concerning the following question:

Seeking advice on use of CiviCRM::Client::REST, pls.

I went into the module itself and added debug statements to dump the url's posted to, to STDERR.

I'm told by those on the #civicrm irc channel that the API uses the field names provided by the database tables as keys in its methods. I've checked the drpl_users table and in fact the keys in my login method's arguments do in fact match those field names from the table.

When I harvest the url from output, and run that in a browser, it gets me to an access denied page, with a login form. Using these credentials on that login form gets me to the civiCRM menu page, suggesting to me that the url is at least reasonably well formed.

There are several other tests coded and failing at this point, but they are all expected to (and in fact do) fail unless the ->login() method succeeds. Any and all ideas for how to move past this issue would be appreciated.

Thanks,
-- Hugh

#!/usr/bin/perl use strict; use warnings; use CiviCRM::Client; use Data::Dumper; my $civicrm = CiviCRM::Client::REST->new( 'http://example.org', '37736c686aeGrt54skk705bfa9a9Hgsfll81'); print STDERR Dumper($civicrm); if($civicrm->login({ 'name' => 'hesco', 'pass' => 'secret' })){ print STDERR "succeeded in login attempt \n"; } else { print STDERR "failed to login \n"; }
gives me this output:

$VAR1 = bless( { '_civicrmUrl' => 'http://example.org', '_ua' => bless( { 'max_redirect' => 7, 'protocols_forbidden' => undef, 'show_progress' => undef, 'handlers' => { 'response_header' = +> bless( [ + { + 'owner' => 'LWP::UserAgent::parse_head', + 'callback' => sub { "DUMMY" }, + 'm_media_type' => 'html', + 'line' => '/usr/local/share/perl/5.10.0/LWP/UserAgent.pm +:608' + } + ], 'HTTP::Config' ) }, 'no_proxy' => [], 'protocols_allowed' => undef, 'use_eval' => 1, 'requests_redirectable' => [ 'GET', 'HEAD' ], 'timeout' => 180, 'def_headers' => bless( { 'user-age +nt' => 'libwww-perl/5.830' }, 'HTTP::H +eaders' ), 'proxy' => {}, 'max_size' => undef }, 'LWP::UserAgent' ), '_sessionKeyName' => 'key', '_siteKey' => '37736c686aeGrt54skk705bfa9a9Hgsfll81' }, 'CiviCRM::Client::REST' ); failed to login
if( $lal && $lol ) { $life++; }
if( $insurance->rationing() ) { $people->die(); }