View | Details | Raw Unified | Return to bug 29183
Collapse All | Expand All

(-)a/api/v1/swagger/swagger.yaml (-1 / +32 lines)
Lines 48-53 info: Link Here
48
    Note: Some routes might offer additional attributes in their error responses but that's
48
    Note: Some routes might offer additional attributes in their error responses but that's
49
    subject to change and thus not documented.
49
    subject to change and thus not documented.
50
50
51
    ## Filtering responses
52
    
53
    The API allows for some advanced response filtering using a json based query syntax that 
54
    can be added as a query parameter, `q=` or in the request body.
55
56
    For simple field equality matches we can use `{ "fieldname": "value" }` where the fieldname
57
    matches one of the fields as described in the particular endpoints response object.
58
59
    We can refine that with more complex matching clauses by nesting a the clause into the 
60
    object; `{ "fieldname": { "clause": "value" } }`.
61
62
    Available matching clauses include ">", "<", ">=", "<=", "-like", and "-not_like".
63
64
    We can filter on multiple fields by adding them to the JSON respresentation. Adding at `HASH` 
65
    level will result in an 'AND' query, whilst combinding them in an `ARRAY` wilth result in an
66
    'OR' query: `{ "field1": 'value2', "field2": "value2" }` will filter the response to only those
67
    results with both field1 containing value2 AND field2 containing value2 for example.
68
69
    ### Examples
70
71
    The following request would return any patron with firstname "Henry" and lastname "Acevedo";
72
73
    `curl -u koha:koha --request GET 'http://127.0.0.1:8081/api/v1/patrons/' --data-raw '{ "surname": "Acevedo", "firstname": "Henry" }'`
74
75
    The following request would return any patron whose lastname begins with "Ace";
76
77
    `curl -u koha:koha --request GET 'http://127.0.0.1:8081/api/v1/patrons/' --data-raw '{ "surname": { "-like": "Ace%" }'`
78
79
    The following request would return any patron whilse lastname is 'Acevedo' OR 'Bernardo'
80
81
    `curl -u koha:koha --request GET 'http://127.0.0.1:8081/api/v1/patrons/' --data-raw '{ "surname": [ "Acevedo", "Bernardo" ] }'`
82
51
    ## Special headers
83
    ## Special headers
52
84
53
    ### x-koha-library
85
    ### x-koha-library
54
- 

Return to bug 29183