Bug 28020: (follow-up) Add docs about error_code on the API
[koha.git] / api / v1 / swagger / paths / patrons_account.yaml
1 ---
2 "/patrons/{patron_id}/account":
3   get:
4     x-mojo-to: Patrons::Account#get
5     operationId: getPatronAccount
6     tags:
7       - patrons
8     summary: Get account information for a patron
9     parameters:
10       - $ref: ../parameters.yaml#/patron_id_pp
11     produces:
12       - application/json
13     responses:
14       "200":
15         description: Patron's account balance
16         schema:
17           $ref: ../definitions.yaml#/patron_balance
18       "401":
19         description: Authentication required
20         schema:
21           $ref: ../definitions.yaml#/error
22       "403":
23         description: Access forbidden
24         schema:
25           $ref: ../definitions.yaml#/error
26       "404":
27         description: Patron not found
28         schema:
29           $ref: ../definitions.yaml#/error
30       "500":
31         description: |
32           Internal server error. Possible `error_code` attribute values:
33
34           * `internal_server_error`
35         schema:
36           $ref: ../definitions.yaml#/error
37       "503":
38         description: Under maintenance
39         schema:
40           $ref: ../definitions.yaml#/error
41     x-koha-authorization:
42       permissions:
43         borrowers: edit_borrowers
44         updatecharges: remaining_permissions
45 "/patrons/{patron_id}/account/credits":
46   post:
47     x-mojo-to: Patrons::Account#add_credit
48     operationId: addPatronCredit
49     tags:
50       - patrons
51     summary: Add credit to a patron's account
52     parameters:
53       - $ref: ../parameters.yaml#/patron_id_pp
54       - name: body
55         in: body
56         description: A JSON object containing credit information
57         required: true
58         schema:
59           $ref: ../definitions.yaml#/patron_account_credit
60     produces:
61       - application/json
62     responses:
63       "201":
64         description: Credit added
65         schema:
66           $ref: ../definitions.yaml#/account_line
67       "401":
68         description: Authentication required
69         schema:
70           $ref: ../definitions.yaml#/error
71       "403":
72         description: Access forbidden
73         schema:
74           $ref: ../definitions.yaml#/error
75       "404":
76         description: Patron not found
77         schema:
78           $ref: ../definitions.yaml#/error
79       "500":
80         description: |
81           Internal server error. Possible `error_code` attribute values:
82
83           * `internal_server_error`
84         schema:
85           $ref: ../definitions.yaml#/error
86       "503":
87         description: Under maintenance
88         schema:
89           $ref: ../definitions.yaml#/error
90     x-koha-authorization:
91       permissions:
92         updatecharges: remaining_permissions