Koha/api/v1/swagger/paths/acquisitions_orders.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

375 lines
12 KiB
JSON

{
"/acquisitions/orders": {
"get": {
"x-mojo-to": "Acquisitions::Orders#list",
"operationId": "listOrders",
"tags": [
"acquisitions",
"orders"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "biblio_id",
"in": "query",
"description": "Identifier for a linked bibliographic record",
"required": false,
"type": "integer"
},
{
"name": "basket_id",
"in": "query",
"description": "Identifier for a linked acquisition basket",
"required": false,
"type": "integer"
},
{
"name": "fund_id",
"in": "query",
"description": "Identifier for the fund the order goes against",
"required": false,
"type": "integer"
},
{
"name": "status",
"in": "query",
"description": "Current status for the order. Can be 'new', 'ordered', 'partial', 'complete' or 'cancelled'",
"required": false,
"type": "string"
},
{
"$ref": "../parameters.json#/match"
},
{
"$ref": "../parameters.json#/order_by"
},
{
"$ref": "../parameters.json#/page"
},
{
"$ref": "../parameters.json#/per_page"
}
],
"responses": {
"200": {
"description": "A list of orders",
"schema": {
"type": "array",
"items": {
"$ref": "../definitions.json#/order"
}
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Order 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": {
"acquisition": [ "order_manage", "order_manage_all" ]
}
},
"x-koha-embed": [
"basket",
"fund",
"invoice",
"subscription",
"items",
"biblio"
]
},
"post": {
"x-mojo-to": "Acquisitions::Orders#add",
"operationId": "addOrder",
"tags": [
"acquisitions",
"orders"
],
"parameters": [
{
"name": "body",
"in": "body",
"description": "A JSON object representing an order",
"required": true,
"schema": {
"$ref": "../definitions.json#/order"
}
}
],
"produces": [
"application/json"
],
"responses": {
"201": {
"description": "Order added",
"schema": {
"$ref": "../definitions.json#/order"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"409": {
"description": "Conflict in creating the resource",
"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": {
"acquisition": "order_manage"
}
}
}
},
"/acquisitions/orders/{order_id}": {
"get": {
"x-mojo-to": "Acquisitions::Orders#get",
"operationId": "getOrder",
"tags": [
"acquisitions",
"orders"
],
"parameters": [
{
"$ref": "../parameters.json#/order_id_pp"
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "An order",
"schema": {
"$ref": "../definitions.json#/order"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Order 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": {
"acquisition": "order_manage"
}
},
"x-koha-embed": [
"basket",
"fund",
"invoice",
"subscription",
"items",
"biblio"
]
},
"put": {
"x-mojo-to": "Acquisitions::Orders#update",
"operationId": "updateOrder",
"tags": [
"acquisitions",
"orders"
],
"parameters": [
{
"$ref": "../parameters.json#/order_id_pp"
},
{
"name": "body",
"in": "body",
"description": "A JSON object representing an order",
"required": true,
"schema": {
"$ref": "../definitions.json#/order"
}
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "An order",
"schema": {
"$ref": "../definitions.json#/order"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Order 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": {
"acquisition": "order_manage"
}
}
},
"delete": {
"x-mojo-to": "Acquisitions::Orders#delete",
"operationId": "deleteOrder",
"tags": [
"acquisitions",
"orders"
],
"parameters": [
{
"$ref": "../parameters.json#/order_id_pp"
}
],
"produces": [
"application/json"
],
"responses": {
"204": {
"description": "Order deleted"
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Order 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": {
"acquisition": "order_manage"
}
}
}
}
}