Koha/api/v1/swagger/paths/holds.json
Tomas Cohen Arazi 0bb0b6c7b4
Bug 25048: Make successful resource deletion return 204
This patch adapts the spec and the controllers so existing routes return
204 and an empty response body when a successful deletion happens.

Right now we have a coding guideline but haven't adapted the existing
routes.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/*.t
=> FAIL: Some tests fail
3. Apply this patch
4. Repeat 2.
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-29 16:24:43 +01:00

607 lines
16 KiB
JSON

{
"/holds": {
"get": {
"x-mojo-to": "Holds#list",
"operationId": "listHolds",
"tags": ["patrons", "holds"],
"parameters": [
{
"name": "hold_id",
"in": "query",
"description": "Internal reserve identifier",
"type": "integer"
},
{
"name": "patron_id",
"in": "query",
"description": "Internal patron identifier",
"type": "integer"
},
{
"name": "hold_date",
"in": "query",
"description": "Hold",
"type": "string",
"format": "date"
},
{
"name": "biblio_id",
"in": "query",
"description": "Internal biblio identifier",
"type": "integer"
},
{
"name": "pickup_library_id",
"in": "query",
"description": "Internal library identifier for the pickup library",
"type": "string"
},
{
"name": "cancelation_date",
"in": "query",
"description": "The date the hold was cancelled",
"type": "string",
"format": "date"
},
{
"name": "notes",
"in": "query",
"description": "Notes related to this hold",
"type": "string"
},
{
"name": "priority",
"in": "query",
"description": "Where in the queue the patron sits",
"type": "integer"
},
{
"name": "status",
"in": "query",
"description": "Found status",
"type": "string"
},
{
"name": "timestamp",
"in": "query",
"description": "Time of latest update",
"type": "string"
},
{
"name": "item_id",
"in": "query",
"description": "Internal item identifier",
"type": "integer"
},
{
"name": "waiting_date",
"in": "query",
"description": "Date the item was marked as waiting for the patron",
"type": "string"
},
{
"name": "expiration_date",
"in": "query",
"description": "Date the hold expires",
"type": "string"
},
{
"name": "lowest_priority",
"in": "query",
"description": "Lowest priority",
"type": "boolean"
},
{
"name": "suspended",
"in": "query",
"description": "Suspended",
"type": "boolean"
},
{
"name": "suspended_until",
"in": "query",
"description": "Suspended until",
"type": "string"
},
{
"$ref": "../parameters.json#/match"
},
{
"$ref": "../parameters.json#/order_by"
},
{
"$ref": "../parameters.json#/page"
},
{
"$ref": "../parameters.json#/per_page"
}
],
"produces": ["application/json"],
"responses": {
"200": {
"description": "A list of holds",
"schema": {
"$ref": "../definitions.json#/holds"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Hold not allowed",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Borrower not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"borrowers": "edit_borrowers"
}
}
},
"post": {
"x-mojo-to": "Holds#add",
"operationId": "addHold",
"tags": ["patrons", "holds"],
"parameters": [{
"name": "body",
"in": "body",
"description": "A JSON object containing informations about the new hold",
"required": true,
"schema": {
"type": "object",
"properties": {
"patron_id": {
"description": "Internal patron identifier",
"type": "integer"
},
"biblio_id": {
"description": "Internal biblio identifier",
"type": [ "integer", "null" ]
},
"item_id": {
"description": "Internal item identifier",
"type": [ "integer", "null" ]
},
"pickup_library_id": {
"description": "Internal library identifier for the pickup library",
"type": "string"
},
"expiration_date": {
"description": "Hold end date",
"type": ["string", "null"],
"format": "date"
},
"notes": {
"description": "Notes related to this hold",
"type": [ "string", "null" ]
},
"item_type": {
"description": "Limit hold on one itemtype (ignored for item-level holds)",
"type": [ "string", "null" ]
}
},
"required": [ "patron_id", "pickup_library_id" ]
}
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"201": {
"description": "Created hold",
"schema": {
"$ref": "../definitions.json#/hold"
}
},
"400": {
"description": "Missing or wrong parameters",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Hold not allowed",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Borrower not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"reserveforothers": "1"
}
}
}
},
"/holds/{hold_id}": {
"put": {
"x-mojo-to": "Holds#edit",
"operationId": "editHold",
"tags": ["holds"],
"parameters": [{
"$ref": "../parameters.json#/hold_id_pp"
}, {
"name": "body",
"in": "body",
"description": "A JSON object containing fields to modify",
"required": true,
"schema": {
"type": "object",
"properties": {
"priority": {
"description": "Position in waiting queue",
"type": "integer",
"minimum": 1
},
"branchcode": {
"description": "Pickup location",
"type": "string"
},
"suspend_until": {
"description": "Suspend until",
"type": "string",
"format": "date"
}
}
}
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Updated hold",
"schema": {
"$ref": "../definitions.json#/hold"
}
},
"400": {
"description": "Missing or wrong parameters",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Hold not allowed",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Hold not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"reserveforothers": "1"
}
}
},
"delete": {
"x-mojo-to": "Holds#delete",
"operationId": "deleteHold",
"tags": ["holds"],
"parameters": [{
"$ref": "../parameters.json#/hold_id_pp"
}
],
"produces": ["application/json"],
"responses": {
"204": {
"description": "Hold deleted"
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Hold not allowed",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Hold not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"reserveforothers": "1"
}
}
}
},
"/holds/{hold_id}/priority": {
"put": {
"x-mojo-to": "Holds#update_priority",
"operationId": "updateHoldPriority",
"tags": [
"biblios",
"holds"
],
"parameters": [
{
"$ref": "../parameters.json#/hold_id_pp"
},
{
"name": "body",
"in": "body",
"description": "An integer representing the new priority to be set for the hold",
"required": true,
"schema": {
"type": "integer"
}
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "The new priority value for the hold",
"schema": {
"type": "integer"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Biblio not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"409": {
"description": "Unable to perform action on biblio",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"reserveforothers": "modify_holds_priority"
}
}
}
},
"/holds/{hold_id}/suspension": {
"post": {
"x-mojo-to": "Holds#suspend",
"operationId": "suspendHold",
"tags": ["holds"],
"parameters": [{
"$ref": "../parameters.json#/hold_id_pp"
}, {
"name": "body",
"in": "body",
"description": "A JSON object containing fields to modify",
"required": false,
"schema": {
"type": "object",
"properties": {
"end_date": {
"description": "Date the hold suspension expires",
"type": "string",
"format": "date"
}
}
}
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"201": {
"description": "Hold suspended"
},
"400": {
"description": "Missing or wrong parameters",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Hold not allowed",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Hold not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"reserveforothers": "1"
}
}
},
"delete": {
"x-mojo-to": "Holds#resume",
"operationId": "resumeHold",
"tags": ["holds"],
"parameters": [
{
"$ref": "../parameters.json#/hold_id_pp"
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"responses": {
"204": {
"description": "Hold resumed"
},
"400": {
"description": "Missing or wrong parameters",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Hold not allowed",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Hold not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"reserveforothers": "1"
}
}
}
}
}