[Koha-devel] Issues sending a JSON request body in a GET request to REST API
David Cook
dcook at prosentient.com.au
Fri May 12 08:47:07 CEST 2023
Hi all,
With the Koha REST API, there's "Advanced Matching" which uses a JSON body
in a GET request:
curl -u koha:koha --request GET 'http://127.0.0.1:8081/api/v1/patrons/'
--header "Content-Type: application/json" --data-raw '{ "-or": [ {
"surname": { "-like": "Acev%" } }, { "firstname": { "-like": "Hen%" } } ] }'
https://wiki.koha-community.org/wiki/Koha_REST_API_Users_Guide#Advanced_Matc
hing
While this technically works, we really shouldn't be sending a JSON request
body in a GET request.
I'm working on a third-party system, and it's actually preventing me from
sending GET requests with request bodies (since GET requests aren't supposed
to have request bodies), so I can't actually use the API using that system's
built-ins. I'll have to code a workaround.
At some point, we should replace these GET requests with POSTed search
queries I think.
David Cook
Senior Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061
Australia
Office: 02 9212 0899
Online: 02 8005 0595
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20230512/12e19c78/attachment.htm>
More information about the Koha-devel
mailing list