David, that's correct, you should use the query parameter in that case. We
really added the possibility of passing the query in the request body
because we were looking for examples and that's what ES does. But it is not
used in Koha, internally.

El vie, 12 may 2023 a las 3:58, David Cook (<dc...@prosentient.com.au>)
escribió:

> In the short term, it appears I’ve forgotten about the “q” parameter. It
> takes an unencoded argument, so that’s getting me where I need to go…
>
>
>
> 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
>
>
>
> *From:* David Cook <dc...@prosentient.com.au>
> *Sent:* Friday, 12 May 2023 4:47 PM
> *To:* 'Koha Devel' <koha-devel@lists.koha-community.org>
> *Subject:* Issues sending a JSON request body in a GET request to REST API
>
>
>
> 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_Matching
>
>
>
> 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
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/
>


-- 
Tomás Cohen Arazi
Theke Solutions (http://theke.io)
✆ +54 9351 3513384
GPG: B2F3C15F
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/

Reply via email to