Bug 23667 - Add API route for listing items
Summary: Add API route for listing items
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Martin Renvoize
URL: https://wiki.koha-community.org/wiki/...
Keywords:
Depends on:
Blocks: 33146
  Show dependency treegraph
 
Reported: 2019-09-22 22:31 UTC by Stefan Kugler
Modified: 2023-03-06 11:14 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00


Attachments
Bug 23667: Add spec (3.21 KB, patch)
2019-09-23 15:52 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 23667: Add route to GET /items (4.43 KB, patch)
2019-09-23 15:52 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 23667: (follow-up) Cleanup (667 bytes, patch)
2019-09-23 15:54 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 23667: Add route to GET /items (4.63 KB, patch)
2019-09-30 10:24 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 23667: Add spec (3.26 KB, patch)
2019-10-02 09:59 UTC, Jesse Maseto
Details | Diff | Splinter Review
Bug 23667: Add route to GET /items (4.68 KB, patch)
2019-10-02 10:00 UTC, Jesse Maseto
Details | Diff | Splinter Review
Bug 23667: Add spec (3.33 KB, patch)
2019-10-29 12:11 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 23667: Add route to GET /items (4.55 KB, patch)
2019-10-29 12:11 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Kugler 2019-09-22 22:31:06 UTC
Add API route to get an item by barcode (extension to bug 16825), eg:

GET /items?barcode={barcode}
Comment 1 Tomás Cohen Arazi 2019-09-23 14:17:54 UTC
We really need to implement the

GET /items

route. Which would include filters on many of the item attributes. including barcode. It will, tough, return a list of matching items (probably only one if filtering by barcode).
Comment 2 Tomás Cohen Arazi 2019-09-23 15:52:07 UTC
Created attachment 93129 [details] [review]
Bug 23667: Add spec
Comment 3 Tomás Cohen Arazi 2019-09-23 15:52:11 UTC Comment hidden (obsolete)
Comment 4 Tomás Cohen Arazi 2019-09-23 15:54:52 UTC Comment hidden (obsolete)
Comment 5 Joonas Kylmälä 2019-09-30 10:17:52 UTC Comment hidden (obsolete)
Comment 6 Tomás Cohen Arazi 2019-09-30 10:24:01 UTC
Created attachment 93230 [details] [review]
Bug 23667: Add route to GET /items

This patchset introduces a route to fetch items. It relies on the
already implemented code/mappings to get a single item.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass!
- Try the endpoint with your favourite API tool (Postman?)
- Sign off :-D

Note: to do exact searching on barcode, you need to build the query like
this:

GET /api/v1/items?external_id=<your_barcode>&_match=exact
Comment 7 Tomás Cohen Arazi 2019-09-30 10:25:34 UTC
(In reply to Joonas Kylmälä from comment #5)
> (In reply to Tomás Cohen Arazi from comment #4)
> > Created attachment 93131 [details] [review] [review] [review]
> > Bug 23667: (follow-up) Cleanup
> 
> Since you are the author in both of these patches can you submit a new
> version of "Bug 23667: Add route to GET /items" instead of creating a
> follow-up? It would make it easier to review and read git history. See
> "follow-up patches must be squashed if not signed-off yet, and the history
> is not needed" in
> https://wiki.koha-community.org/wiki/
> Development_IRC_meeting_27_September_2017

Thanks, good catch. I didn't know/remember that rule.
Comment 8 Jesse Maseto 2019-10-02 09:59:40 UTC
Created attachment 93404 [details] [review]
Bug 23667: Add spec

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Comment 9 Jesse Maseto 2019-10-02 10:00:07 UTC
Created attachment 93405 [details] [review]
Bug 23667: Add route to GET /items

This patchset introduces a route to fetch items. It relies on the
already implemented code/mappings to get a single item.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass!
- Try the endpoint with your favourite API tool (Postman?)
- Sign off :-D

Note: to do exact searching on barcode, you need to build the query like
this:

GET /api/v1/items?external_id=<your_barcode>&_match=exact

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Comment 10 Martin Renvoize 2019-10-29 12:11:00 UTC
Created attachment 94829 [details] [review]
Bug 23667: Add spec

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize 2019-10-29 12:11:03 UTC
Created attachment 94830 [details] [review]
Bug 23667: Add route to GET /items

This patchset introduces a route to fetch items. It relies on the
already implemented code/mappings to get a single item.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass!
- Try the endpoint with your favourite API tool (Postman?)
- Sign off :-D

Note: to do exact searching on barcode, you need to build the query like
this:

GET /api/v1/items?external_id=<your_barcode>&_match=exact

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2019-10-29 12:11:25 UTC
Works well, passes qa scripts.. Passing QA
Comment 13 Martin Renvoize 2019-10-29 12:21:02 UTC
Nice work!

Pushed to master for 19.11.00