|
Lines 721-730
info:
Link Here
|
| 721 |
We can refine that with more complex matching clauses by nesting a the clause into the |
721 |
We can refine that with more complex matching clauses by nesting a the clause into the |
| 722 |
object; `{ "fieldname": { "clause": "value" } }`. |
722 |
object; `{ "fieldname": { "clause": "value" } }`. |
| 723 |
|
723 |
|
| 724 |
Available matching clauses include ">", "<", ">=", "<=", "-like", and "-not_like". |
724 |
Available matching clauses include `>`, `<`, `>=`, `<=`, `-like`, and `-not_like`. |
| 725 |
|
725 |
|
| 726 |
We can filter on multiple fields by adding them to the JSON respresentation. Adding at `HASH` |
726 |
We can filter on multiple fields by adding them to the JSON respresentation. Adding at `HASH` |
| 727 |
level will result in an "AND" query, whilst combinding them in an `ARRAY` wilth result in an |
727 |
level will result in an "AND" query, whilst combinding them in an `ARRAY` will result in an |
| 728 |
"OR" query: `{ "field1": "value2", "field2": "value2" }` will filter the response to only those |
728 |
"OR" query: `{ "field1": "value2", "field2": "value2" }` will filter the response to only those |
| 729 |
results with both field1 containing value2 AND field2 containing value2 for example. |
729 |
results with both field1 containing value2 AND field2 containing value2 for example. |
| 730 |
|
730 |
|
|
Lines 735-749
info:
Link Here
|
| 735 |
|
735 |
|
| 736 |
The following request would return any patron with firstname "Henry" and lastname "Acevedo"; |
736 |
The following request would return any patron with firstname "Henry" and lastname "Acevedo"; |
| 737 |
|
737 |
|
| 738 |
`curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw "{ "surname": "Acevedo", "firstname": "Henry" }"` |
738 |
`curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw '{ "surname": "Acevedo", "firstname": "Henry" }'` |
| 739 |
|
739 |
|
| 740 |
The following request would return any patron whose lastname begins with "Ace"; |
740 |
The following request would return any patron whose lastname begins with "Ace"; |
| 741 |
|
741 |
|
| 742 |
`curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw "{ "surname": { "-like": "Ace%" }"` |
742 |
`curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw '{ "surname": { "-like": "Ace%" }'` |
| 743 |
|
743 |
|
| 744 |
The following request would return any patron whose lastname is "Acevedo" OR "Bernardo" |
744 |
The following request would return any patron whose lastname is "Acevedo" OR "Bernardo" |
| 745 |
|
745 |
|
| 746 |
`curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw "{ "surname": [ "Acevedo", "Bernardo" ] }"` |
746 |
`curl -u koha:koha --request GET "http://127.0.0.1:8081/api/v1/patrons/" --data-raw '{ "surname": [ "Acevedo", "Bernardo" ] }'` |
| 747 |
|
747 |
|
| 748 |
The following request embeds the related patron extended attributes data and filters on it. |
748 |
The following request embeds the related patron extended attributes data and filters on it. |
| 749 |
|
749 |
|
| 750 |
- |
|
|