Bugzilla – Attachment 185579 Details for
Bug 29900
API calls should update datelastseen for API patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
TEST SCRIPT: api_basic_test.pl
api_basic_test.pl (text/plain), 2.12 KB, created by
CJ Lynce
on 2025-08-19 20:52:09 UTC
(
hide
)
Description:
TEST SCRIPT: api_basic_test.pl
Filename:
MIME Type:
Creator:
CJ Lynce
Created:
2025-08-19 20:52:09 UTC
Size:
2.12 KB
patch
obsolete
># Test Script for Bug 29900 ># based off https://wiki.koha-community.org/wiki/REST_API:_Checking_username_and_password ># ># Change API_USERNAME and API_PASSWORD to your test "apibasic" user's koha username and password. ># ># See bottom for expected output of a successful validation ># run the script on your KTD or koha installation using #>perl api_basic_test.pl > >use Modern::Perl; >use LWP::UserAgent; >use HTTP::Request::Common; >use JSON; >use Data::Dumper; >$Data::Dumper::Sortkeys = 1; > >my $domain = 'localhost:8080'; >my $username = 'API_USERNAME'; #CHANGE ME >my $password = 'API_PASSWORD'; #CHANGE ME > >my %data = ( > 'userid' => 'koha', > 'password' => 'koha', >); > >my $ua = LWP::UserAgent->new(); >my $request = HTTP::Request::Common::POST( > "http://$domain/api/v1/auth/password/validation", > Content_Type => 'application/json', > Content => to_json( \%data ) >); > >$request->authorization_basic( $username, $password ); > >say Dumper $request; > >my $response = $ua->request($request); >say $response->as_string(); > ># Expected output for successful validation# ># ># ># $VAR1 = bless( { ># '_content' => '{"password":"koha","userid":"koha"}', ># '_headers' => bless( { ># 'authorization' => 'Basic YXBpYmFzaWM6QWJjZDEyMzQ=', ># 'content-length' => 35, ># 'content-type' => 'application/json' ># }, 'HTTP::Headers' ), ># '_max_body_size' => undef, ># '_method' => 'POST', ># '_uri' => bless( do{\(my $o = 'http://localhost:8080/api/v1/auth/password/validation')}, 'URI::http' ) ># }, 'HTTP::Request' ); ># ># HTTP/1.1 201 Created ># Connection: close ># Date: Tue, 19 Aug 2025 20:48:01 GMT ># Server: Apache/2.4.62 (Debian) ># Vary: User-Agent ># ontent-Length: 50 ># Content-Type: application/json;charset=UTF-8 ># Client-Date: Tue, 19 Aug 2025 20:48:01 GMT ># Client-Peer: 127.0.0.1:8080 ># lient-Response-Num: 1 ># ># {"cardnumber":"42","patron_id":51,"userid":"koha"}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 29900
:
185533
|
185578
| 185579 |
185580
|
185581