[Koha-bugs] [Bug 28157] Add the ability to set a library from which an API request pretends to come from
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Apr 23 01:43:43 CEST 2021
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28157
--- Comment #16 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
(In reply to David Cook from comment #15)
> Actually, after reviewing the patches again, I think that I get the idea.
>
> With an interactive session, we're logging in with username, password, and
> target branch.
>
> However, with an API session, we're logging in using only username and
> password, so we don't really have any way of providing a branch.
The catch is, the API is stateless. If it being used from a browser with a
session cookie, then we're are all set. But the API is not designed with that
only use case in mind.
> So unless we require people to switch branches using an API endpoint first,
> the only other option is to provide that x-koha-library header or I suppose
> embed the library ID in the route like you've suggested.
Switching branch using a route implies state.
> I suppose an alternative would be to pass the target branch in parameters
> but that would only work for certain endpoints.
The header is a parameter he he. If you mean query parameters, they are
expected to be used for filtering purposes in a Restful design.
> Hmm feels too abstract at the moment for me to really think of concrete
> examples.
This dev is actually written to solve a very concrete problem we noticed with
extended attributes routes. Extended attributes visibility and setability are
by design (in Koha) something that depends on the current library. Look at
Koha::Patron::Attributes->filter_by_branch (don't remember the exact name, on
the phone).
> But I suppose the patch is already pushed so it doesn't really matter
> anymore heh.
It does! So next time you need to write routes, you can take advantage of it!
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list