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

David Nind <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]
  Text to go in the|                            |This enhancement adds a new
      release notes|                            |API route to request a
                   |                            |patron image, if it exists.
                   |                            |Errors are returned if a
                   |                            |patron number doesn't exist
                   |                            |or there is no patron
                   |                            |image.
                   |                            |
                   |                            |Example API request:
                   |                            |http://127.0.0.1:8081/api/v
                   |                            |1/patrons/49/default_image
                   |                            |
                   |                            |Error messages:
                   |                            |- If there is no patron
                   |                            |image: Patron image not
                   |                            |found.
                   |                            |- If the patron doesn't
                   |                            |exist: Patron not found.

--- Comment #23 from David Nind <[email protected]> ---
Testing notes (using KTD):

1. Before applying the patch, check the API documentation at
http://127.0.0.1:8080/api/v1/.html and search for getPatronImage - you
shouldn't get any results.
2. Apply the patches
3. Rebuild the API and restart everything:
   . yarn build
   . restart_all
4. Repeat step 1, and now you should get some results.
5. I added an image to Mary Burton - borrowernumber = 49
6. Using Bruno API tool, with basic authentication (koha, koha), I made a GET
request to GET http://127.0.0.1:8081/api/v1/patrons/49/default_image and an
image was returned .
7. With an invalid patron - 999:
     GET http://127.0.0.1:8081/api/v1/patrons/999/default_image
     ==> Error message is:
           {
             "error": "Patron not found."
           }
8. With a patron without an image - 51:
     GET http://127.0.0.1:8081/api/v1/patrons/51/default_image
     ===> Error message is:
          {
            "error": "Patron image not found."
          }
9. I didn't test using OAuth 2.0 as I couldn't figure out how to use Brun for
this, but I did work out part of it.
   9.1 To generate a token to test OAuth 2.0
       - Set RESTOAuth2ClientCredentials = enable
       - Generate the credentials for a patron: Patrons > [selected patron] >
More > Manage API keys > Generate a new client id/secret pair
10. The tests pass: prove t/db_dependent/api/v1/image.t

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to