<div dir="auto">I use Postman which has richer authentication options.<div dir="auto"><br></div><div dir="auto">Dcook: this is related to not using plack, right?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El jue., 12 de marzo de 2020 06:50, David Nind <<a href="mailto:david.nind@gmail.com">david.nind@gmail.com</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><li style="margin-left:0cm">> 500 Internal Server error (with no obvious messages in the server logs other than a missing “Routing to a callback”)</li><ol style="margin-top:0cm" type="a" start="1"><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/items" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/items</a></li><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/patrons" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/patrons</a></li><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/libraries" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/libraries</a></li></ol><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>If I use 127.0.0.1 (rather than localhost) I get responses (on master).</div><div><br></div><div>If RESTPublicAPI is disabled I get {"error":"Something went wrong, check the logs."}</div><div><br></div><div><a href="https://wiki.koha-community.org/wiki/Using_the_Koha_REST_API" target="_blank" rel="noreferrer">https://wiki.koha-community.org/wiki/Using_the_Koha_REST_API</a></div><div><br></div><div>Maybe something is wrong with your koha-testing-docker setup?</div><div><br></div><div>David Nind | <a href="mailto:david.nind@gmail.com" target="_blank" rel="noreferrer">david.nind@gmail.com</a><br>PO Box 12367, Thorndon, Wellington, New Zealand 6144<br>m. +64 21 0537 847</div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 12 Mar 2020 at 17:41, <<a href="mailto:dcook@prosentient.com.au" target="_blank" rel="noreferrer">dcook@prosentient.com.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-AU"><div><p class="MsoNormal">Hi all,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I’m finally getting around to playing with the REST API, but it’s not quite working as expected.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">In koha-testing-docker (with the latest koha-testing-docker git repo and Docker images as of this writing), I’m getting the following in the browser:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ol style="margin-top:0cm" type="1" start="1"><li style="margin-left:0cm">200 OK<u></u><u></u></li><ol style="margin-top:0cm" type="a" start="1"><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/.html" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/.html</a><u></u><u></u></li><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/</a> or <a href="http://localhost:8080/api/v1/.json" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/.json</a> <u></u><u></u></li></ol><li style="margin-left:0cm">500 Internal Server error (with no obvious messages in the server logs other than a missing “Routing to a callback”)<u></u><u></u></li><ol style="margin-top:0cm" type="a" start="1"><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/items" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/items</a><u></u><u></u></li><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/patrons" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/patrons</a><u></u><u></u></li><li style="margin-left:0cm"><a href="http://localhost:8080/api/v1/libraries" target="_blank" rel="noreferrer">http://localhost:8080/api/v1/libraries</a><u></u><u></u></li></ol></ol><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">If I use “curl” or a Perl script, then I get a 401 error instead of a 500 error. (Although in Koha 19.11, I can get JSON results in either the browser or with curl for those endpoints, but that’s a whole other matter.)<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">RESTBasicAuth = 1 means I can use the API via curl, but still nothing via the browser. Which is fine I guess in practice but it’s not really what you’d expect. I often use browser requests to test out GET requests for APIs. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I don’t really get how RESTPublicAPI works either. If it’s disabled, it says ‘{"error":"Configuration prevents the usage of this endpoint by unprivileged users"}’, but that doesn’t seem accurate, since disabling that system preference blocks the /public APIs in general, right? Even if you use a privileged user, it still doesn’t work.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Actually, even with RESTPublicAPI enabled, I can’t get the /public endpoints to work. I get errors like this ‘{"error":"Authorization failure. Missing required permission(s).","required_permissions":null}’. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">This email is getting a bit long and I think I have a million other API problems, so I might just work through one by one and open Bugzilla tickets as I go…<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">David Cook<u></u><u></u></p><p class="MsoNormal">Systems Librarian<u></u><u></u></p><p class="MsoNormal">Prosentient Systems<u></u><u></u></p><p class="MsoNormal">72/330 Wattle St<u></u><u></u></p><p class="MsoNormal">Ultimo, NSW 2007<u></u><u></u></p><p class="MsoNormal">Australia<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Office: 02 9212 0899<u></u><u></u></p><p class="MsoNormal">Direct: 02 8005 0595<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div>_______________________________________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org" target="_blank" rel="noreferrer">Koha-devel@lists.koha-community.org</a><br>
<a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer noreferrer" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
website : <a href="http://www.koha-community.org/" rel="noreferrer noreferrer" target="_blank">http://www.koha-community.org/</a><br>
git : <a href="http://git.koha-community.org/" rel="noreferrer noreferrer" target="_blank">http://git.koha-community.org/</a><br>
bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer noreferrer" target="_blank">http://bugs.koha-community.org/</a><br>
</blockquote></div>
_______________________________________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org" target="_blank" rel="noreferrer">Koha-devel@lists.koha-community.org</a><br>
<a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer noreferrer" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
website : <a href="http://www.koha-community.org/" rel="noreferrer noreferrer" target="_blank">http://www.koha-community.org/</a><br>
git : <a href="http://git.koha-community.org/" rel="noreferrer noreferrer" target="_blank">http://git.koha-community.org/</a><br>
bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer noreferrer" target="_blank">http://bugs.koha-community.org/</a><br>
</blockquote></div>