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

(-)a/Koha/REST/V1/Biblios.pm (+34 lines)
Lines 237-240 sub get_public { Link Here
237
    };
237
    };
238
}
238
}
239
239
240
=head3 get_items
241
242
Controller function that handles retrieving biblio's items
243
244
=cut
245
246
sub get_items {
247
    my $c = shift->openapi->valid_input or return;
248
249
    my $biblio = Koha::Biblios->find( { biblionumber => $c->validation->param('biblio_id') }, { prefetch => ['items'] } );
250
251
    unless ( $biblio ) {
252
        return $c->render(
253
            status  => 404,
254
            openapi => {
255
                error => "Object not found."
256
            }
257
        );
258
    }
259
260
    return try {
261
262
        my $items_rs = $biblio->items;
263
        my $items    = $c->objects->search( $items_rs );
264
        return $c->render(
265
            status  => 200,
266
            openapi => $items
267
        );
268
    }
269
    catch {
270
        $c->unhandled_exception($_);
271
    };
272
}
273
240
1;
274
1;
(-)a/api/v1/swagger/paths.json (-3 / +6 lines)
Lines 17-22 Link Here
17
  "/acquisitions/funds": {
17
  "/acquisitions/funds": {
18
    "$ref": "paths/acquisitions_funds.json#/~1acquisitions~1funds"
18
    "$ref": "paths/acquisitions_funds.json#/~1acquisitions~1funds"
19
  },
19
  },
20
  "/biblios/{biblio_id}": {
21
    "$ref": "paths/biblios.json#/~1biblios~1{biblio_id}"
22
  },
23
  "/biblios/{biblio_id}/items": {
24
    "$ref": "paths/biblios.json#/~1biblios~1{biblio_id}~1items"
25
  },
20
  "/checkouts": {
26
  "/checkouts": {
21
    "$ref": "paths/checkouts.json#/~1checkouts"
27
    "$ref": "paths/checkouts.json#/~1checkouts"
22
  },
28
  },
Lines 35-43 Link Here
35
  "/cities/{city_id}": {
41
  "/cities/{city_id}": {
36
    "$ref": "paths/cities.json#/~1cities~1{city_id}"
42
    "$ref": "paths/cities.json#/~1cities~1{city_id}"
37
  },
43
  },
38
  "/biblios/{biblio_id}": {
39
    "$ref": "paths/biblios.json#/~1biblios~1{biblio_id}"
40
  },
41
  "/clubs/{club_id}/holds": {
44
  "/clubs/{club_id}/holds": {
42
    "$ref": "paths/clubs.json#/~1clubs~1{club_id}~1holds"
45
    "$ref": "paths/clubs.json#/~1clubs~1{club_id}~1holds"
43
  },
46
  },
(-)a/api/v1/swagger/paths/biblios.json (-1 / +98 lines)
Lines 134-139 Link Here
134
      }
134
      }
135
    }
135
    }
136
  },
136
  },
137
  "/biblios/{biblio_id}/items": {
138
    "get": {
139
      "x-mojo-to": "Biblios#get_items",
140
      "operationId": "getBiblioItems",
141
      "tags": [
142
        "biblios",
143
        "items"
144
      ],
145
      "parameters": [
146
        {
147
          "$ref": "../parameters.json#/biblio_id_pp"
148
        },
149
        {
150
          "$ref": "../parameters.json#/match"
151
        },
152
        {
153
          "$ref": "../parameters.json#/order_by"
154
        },
155
        {
156
          "$ref": "../parameters.json#/page"
157
        },
158
        {
159
          "$ref": "../parameters.json#/per_page"
160
        },
161
        {
162
          "$ref": "../parameters.json#/q_param"
163
        },
164
        {
165
          "$ref": "../parameters.json#/q_body"
166
        },
167
        {
168
          "$ref": "../parameters.json#/q_header"
169
        }
170
      ],
171
      "consumes": [
172
        "application/json"
173
      ],
174
      "produces": [
175
        "application/json"
176
      ],
177
      "responses": {
178
        "200": {
179
          "description": "A list of the items attached to the record",
180
          "schema": {
181
            "type": "array",
182
            "items": {
183
              "$ref": "../definitions.json#/item"
184
            }
185
          }
186
        },
187
        "401": {
188
          "description": "Authentication required",
189
          "schema": {
190
            "$ref": "../definitions.json#/error"
191
          }
192
        },
193
        "403": {
194
          "description": "Access forbidden",
195
          "schema": {
196
            "$ref": "../definitions.json#/error"
197
          }
198
        },
199
        "404": {
200
          "description": "Biblio not found",
201
          "schema": {
202
            "$ref": "../definitions.json#/error"
203
          }
204
        },
205
        "406": {
206
          "description": "Not acceptable",
207
          "schema": {
208
            "type": "array",
209
            "description": "Accepted content-types",
210
            "items": {
211
                "type": "string"
212
            }
213
          }
214
        },
215
        "500": {
216
          "description": "Internal server error",
217
          "schema": {
218
            "$ref": "../definitions.json#/error"
219
          }
220
        },
221
        "503": {
222
          "description": "Under maintenance",
223
          "schema": {
224
            "$ref": "../definitions.json#/error"
225
          }
226
        }
227
      },
228
      "x-koha-authorization": {
229
        "permissions": {
230
            "catalogue": "1"
231
        }
232
      }
233
    }
234
  },
137
  "/public/biblios/{biblio_id}": {
235
  "/public/biblios/{biblio_id}": {
138
    "get": {
236
    "get": {
139
      "x-mojo-to": "Biblios#get_public",
237
      "x-mojo-to": "Biblios#get_public",
140
- 

Return to bug 27352