[Koha-bugs] [Bug 24401] REST API: Check-in

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Aug 27 22:54:57 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24401

--- Comment #18 from David Nind <david at davidnind.com> ---
I had a go at testing (using Postman), but I couldn't get things to work
correctly to get the right responses back (reflecting my lack of knowledge
about APIs!)

I've listed below what I tried and the results I got. I'm sure I am doing
something fundamentally wrong here!

I'll leave the testing to someone who knows what they are doing! 8-)

Postman setup
=============

Add a new request, change to POST with the URL
http://127.0.0.1:8081/api/v1/checkouts

For authorisation, set system preference RESTBasicAuth = Enable, then add koha
and koha for type Basic Auth in the Authorization tab in Postman.

For the Body tab in Postman, select the raw option and then JSON as the type of
input.

201 for item checked in
=======================

I couldn't work out the right request to send to check an item in.

Added the patron_id for the user checking item in (koha = 51), otherwise got an
error ( {"error":"Patron not found","error_code":"PATRON_NOT_FOUND"} )

{
    "patron_id": "51",
    "item_id": "578",
    "library_id": "CPL"
}

Same as 400 for item not checked out:

- If item is checked out, get '412 Precondition Failed' and
{"error":"Confirmation error"}.

- If the item is not checked out, it returns '201 Created', and the item is
checked out.

403 for check in not allowed
============================

Made password invalid, returns '403 Forbidden' (as expected) with message:
{"error":"Invalid password","required_permissions":null}

{
    "item_id": "578",
    "library_id": "CPL"
}


409 for Item not found
=======================

Used incorrect value for item_id, returns '409 Conflict' with error:
{"error":"Item not found","error_code":"ITEM_NOT_FOUND"}

{
    "item_id": "9000",
    "library_id": "CPL"
}

400 for item not checked out
============================

I couldn't work out the right request to send to get this response.

I used patron = koha (patron_id = 51) and item = 578.

{
    "patron_id": "51",
    "item_id": "578",
    "library_id": "CPL"
}

Same as 201 for item checked in:

- If item is checked out, get '412 Precondition Failed' and
{"error":"Confirmation error"}.

- If the item is not checked out, it returns '201 Created', and the item is
checked out.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list