Tomas Cohen Arazi
b7b6a85de5
This patch intends to be a guide for inserting Markdown documentation for error codes. The idea is that it can be copied and pasted as-is in new routes. And adapted to new error codes. To test: 1. Apply this patch 2. Run: $ npx redoc-cli@0.10.4 bundle --cdn --output index.html \ api/v1/swagger/swagger.yaml => SUCCESS: It builds correctly 3. Open index.tml on your browser 4. Pick a route, and see the 500 status description includes information about the possible `error_code` values. 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
374 lines
10 KiB
YAML
374 lines
10 KiB
YAML
---
|
|
/libraries:
|
|
get:
|
|
x-mojo-to: Libraries#list
|
|
operationId: listLibraries
|
|
tags:
|
|
- libraries
|
|
summary: List libraries
|
|
parameters:
|
|
- name: name
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on name
|
|
required: false
|
|
type: string
|
|
- name: address1
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on address1
|
|
required: false
|
|
type: string
|
|
- name: address2
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on address2
|
|
required: false
|
|
type: string
|
|
- name: address3
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on address3
|
|
required: false
|
|
type: string
|
|
- name: postal_code
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on postal code
|
|
required: false
|
|
type: string
|
|
- name: city
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on city
|
|
required: false
|
|
type: string
|
|
- name: state
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on state
|
|
required: false
|
|
type: string
|
|
- name: country
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on country
|
|
required: false
|
|
type: string
|
|
- name: phone
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on phone number
|
|
required: false
|
|
type: string
|
|
- name: fax
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on fax number
|
|
required: false
|
|
type: string
|
|
- name: email
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on email address
|
|
required: false
|
|
type: string
|
|
- name: reply_to_email
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on Reply-To email address
|
|
required: false
|
|
type: string
|
|
- name: return_path_email
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on Return-Path email address
|
|
required: false
|
|
type: string
|
|
- name: url
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on website URL
|
|
required: false
|
|
type: string
|
|
- name: ip
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on IP address
|
|
required: false
|
|
type: string
|
|
- name: notes
|
|
in: query
|
|
description: Case insensitive 'starts_with' search on notes
|
|
required: false
|
|
type: string
|
|
- name: opac_info
|
|
in: query
|
|
description: Case insensitive 'starts-with' search on OPAC info
|
|
required: false
|
|
type: string
|
|
- $ref: ../parameters.yaml#/match
|
|
- $ref: ../parameters.yaml#/order_by
|
|
- $ref: ../parameters.yaml#/page
|
|
- $ref: ../parameters.yaml#/per_page
|
|
- $ref: ../parameters.yaml#/q_param
|
|
- $ref: ../parameters.yaml#/q_body
|
|
- $ref: ../parameters.yaml#/q_header
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: A list of libraries
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: ../definitions.yaml#/library
|
|
"500":
|
|
description: |
|
|
Internal server error. Possible `error_code` attribute values:
|
|
|
|
* `internal_server_error`
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"503":
|
|
description: Under maintenance
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
x-koha-authorization:
|
|
permissions:
|
|
catalogue: "1"
|
|
x-koha-embed:
|
|
- smtp_server
|
|
post:
|
|
x-mojo-to: Libraries#add
|
|
operationId: addLibrary
|
|
tags:
|
|
- libraries
|
|
summary: Add library
|
|
parameters:
|
|
- name: body
|
|
in: body
|
|
description: A JSON object containing informations about the new library
|
|
required: true
|
|
schema:
|
|
$ref: ../definitions.yaml#/library
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"201":
|
|
description: Library added
|
|
schema:
|
|
$ref: ../definitions.yaml#/library
|
|
"400":
|
|
description: Bad request
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"401":
|
|
description: Authentication required
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"403":
|
|
description: Access forbidden
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"409":
|
|
description: Conflict in creating resource
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"500":
|
|
description: |
|
|
Internal server error. Possible `error_code` attribute values:
|
|
|
|
* `internal_server_error`
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"503":
|
|
description: Under maintenance
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
x-koha-authorization:
|
|
permissions:
|
|
parameters: manage_libraries
|
|
"/libraries/{library_id}":
|
|
get:
|
|
x-mojo-to: Libraries#get
|
|
operationId: getLibrary
|
|
tags:
|
|
- libraries
|
|
summary: Get library
|
|
parameters:
|
|
- $ref: ../parameters.yaml#/library_id_pp
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: A library
|
|
schema:
|
|
$ref: ../definitions.yaml#/library
|
|
"404":
|
|
description: Library not found
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
x-koha-authorization:
|
|
permissions:
|
|
catalogue: "1"
|
|
x-koha-embed:
|
|
- smtp_server
|
|
put:
|
|
x-mojo-to: Libraries#update
|
|
operationId: updateLibrary
|
|
tags:
|
|
- libraries
|
|
summary: Update library
|
|
parameters:
|
|
- $ref: ../parameters.yaml#/library_id_pp
|
|
- name: body
|
|
in: body
|
|
description: A JSON object containing information on the library
|
|
required: true
|
|
schema:
|
|
$ref: ../definitions.yaml#/library
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: A library
|
|
schema:
|
|
$ref: ../definitions.yaml#/library
|
|
"400":
|
|
description: Bad request
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"401":
|
|
description: Authentication required
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"403":
|
|
description: Access forbidden
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"404":
|
|
description: Library not found
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"500":
|
|
description: |
|
|
Internal server error. Possible `error_code` attribute values:
|
|
|
|
* `internal_server_error`
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"503":
|
|
description: Under maintenance
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
x-koha-authorization:
|
|
permissions:
|
|
parameters: manage_libraries
|
|
delete:
|
|
x-mojo-to: Libraries#delete
|
|
operationId: deleteLibrary
|
|
tags:
|
|
- libraries
|
|
summary: Delete library
|
|
parameters:
|
|
- $ref: ../parameters.yaml#/library_id_pp
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: Library deleted
|
|
schema:
|
|
type: string
|
|
"401":
|
|
description: Authentication required
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"403":
|
|
description: Access forbidden
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"404":
|
|
description: Library not found
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"500":
|
|
description: |
|
|
Internal server error. Possible `error_code` attribute values:
|
|
|
|
* `internal_server_error`
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"503":
|
|
description: Under maintenance
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
x-koha-authorization:
|
|
permissions:
|
|
parameters: manage_libraries
|
|
/public/libraries:
|
|
get:
|
|
x-mojo-to: Libraries#list
|
|
operationId: listLibrariesPublic
|
|
tags:
|
|
- libraries
|
|
summary: List libraries
|
|
parameters:
|
|
- $ref: ../parameters.yaml#/match
|
|
- $ref: ../parameters.yaml#/order_by
|
|
- $ref: ../parameters.yaml#/page
|
|
- $ref: ../parameters.yaml#/per_page
|
|
- $ref: ../parameters.yaml#/q_param
|
|
- $ref: ../parameters.yaml#/q_body
|
|
- $ref: ../parameters.yaml#/q_header
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: A list of libraries
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: ../definitions.yaml#/library
|
|
"500":
|
|
description: |
|
|
Internal server error. Possible `error_code` attribute values:
|
|
|
|
* `internal_server_error`
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"503":
|
|
description: Under maintenance
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"/public/libraries/{library_id}":
|
|
get:
|
|
x-mojo-to: Libraries#get
|
|
operationId: getLibraryPublic
|
|
tags:
|
|
- libraries
|
|
summary: Get library (public)
|
|
parameters:
|
|
- $ref: ../parameters.yaml#/library_id_pp
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: A library
|
|
"401":
|
|
description: Authentication required
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"403":
|
|
description: Access forbidden
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"404":
|
|
description: Library not found
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"406":
|
|
description: Not acceptable
|
|
schema:
|
|
type: array
|
|
description: Accepted content-types
|
|
items:
|
|
type: string
|
|
"500":
|
|
description: |
|
|
Internal server error. Possible `error_code` attribute values:
|
|
|
|
* `internal_server_error`
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|
|
"503":
|
|
description: Under maintenance
|
|
schema:
|
|
$ref: ../definitions.yaml#/error
|