Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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(); }

In reply to Help, pls, w/ CiviCRM::Client::REST->login() failures . . . by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found