Tomas Cohen Arazi
e03e5a2ece
This patch makes the route support requesting (through the Accept header) the MARC record to be output as formatted text as in $record->as_formatted. To test: 1. Apply the unit tests patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/biblios.t => FAIL: Tests fail 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Try the route with your favourite API testing tool (Postman?) => SUCCESS: Accept: text/plain returns the expected results => SUCCESS: Wrong Accept header returns a list of valid formats, and includes 'text/plain'. 6. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
202 lines
4.7 KiB
JSON
202 lines
4.7 KiB
JSON
{
|
|
"/biblios/{biblio_id}": {
|
|
"get": {
|
|
"x-mojo-to": "Biblios#get",
|
|
"operationId": "getBiblio",
|
|
"tags": [
|
|
"biblios"
|
|
],
|
|
"parameters": [
|
|
{
|
|
"$ref": "../parameters.json#/biblio_id_pp"
|
|
}
|
|
],
|
|
"produces": [
|
|
"application/json",
|
|
"application/marcxml+xml",
|
|
"application/marc-in-json",
|
|
"application/marc",
|
|
"text/plain"
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "A biblio"
|
|
},
|
|
"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"
|
|
}
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable",
|
|
"schema": {
|
|
"type": "array",
|
|
"description": "Accepted content-types",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
},
|
|
"x-koha-authorization": {
|
|
"permissions": {
|
|
"catalogue": "1"
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"x-mojo-to": "Biblios#delete",
|
|
"operationId": "deleteBiblio",
|
|
"tags": [
|
|
"biblios"
|
|
],
|
|
"parameters": [
|
|
{
|
|
"$ref": "../parameters.json#/biblio_id_pp"
|
|
}
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Biblio deleted",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"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": {
|
|
"editcatalogue": "edit_catalogue"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/public/biblios/{biblio_id}": {
|
|
"get": {
|
|
"x-mojo-to": "Biblios#get_public",
|
|
"operationId": "getBiblioPublic",
|
|
"tags": [
|
|
"biblios"
|
|
],
|
|
"parameters": [
|
|
{
|
|
"$ref": "../parameters.json#/biblio_id_pp"
|
|
}
|
|
],
|
|
"produces": [
|
|
"application/marcxml+xml",
|
|
"application/marc-in-json",
|
|
"application/marc",
|
|
"text/plain"
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "A biblio"
|
|
},
|
|
"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"
|
|
}
|
|
},
|
|
"406": {
|
|
"description": "Not acceptable",
|
|
"schema": {
|
|
"type": "array",
|
|
"description": "Accepted content-types",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal server error",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
},
|
|
"503": {
|
|
"description": "Under maintenance",
|
|
"schema": {
|
|
"$ref": "../definitions.json#/error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|