Advertisement
Guest User

Koha Swagger conf

a guest
Jun 24th, 2015
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.67 KB | None | 0 0
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "title": "Koha REST API",
  5. "version": "1",
  6. "license": {
  7. "name": "GPL v3",
  8. "url": "http://www.gnu.org/licenses/gpl.txt"
  9. },
  10. "contact": {
  11. "name": "Koha Team",
  12. "url": "http://koha-community.org/"
  13. }
  14. },
  15. "basePath": "/v1",
  16. "paths": {
  17. "/borrowers": {
  18. "get": {
  19. "x-mojo-controller": "Koha::REST::V1::Borrowers",
  20. "x-koha-permission": {
  21. "borrowers": "*"
  22. },
  23. "operationId": "listBorrowers",
  24. "tags": ["borrowers"],
  25. "summary": "just a summary",
  26. "description": "long description",
  27. "produces": [
  28. "application/json"
  29. ],
  30. "responses": {
  31. "200": {
  32. "description": "A list of borrowers",
  33. "schema": {
  34. "type": "array",
  35. "items": {
  36. "$ref": "#/definitions/borrower"
  37. }
  38. }
  39. }
  40. },
  41. "security": [
  42. { "multi_key_auth": [] }
  43. ]
  44. }
  45. },
  46. "/borrowers/{borrowernumber}": {
  47. "get": {
  48. "x-mojo-controller": "Koha::REST::V1::Borrowers",
  49. "x-koha-permission": {
  50. "borrowers": "*"
  51. },
  52. "operationId": "getBorrower",
  53. "tags": ["borrowers"],
  54. "parameters": [
  55. {
  56. "$ref": "#/parameters/borrowernumberPathParam"
  57. }
  58. ],
  59. "produces": [
  60. "application/json"
  61. ],
  62. "responses": {
  63. "200": {
  64. "description": "A borrower",
  65. "schema": {
  66. "$ref": "#/definitions/borrower"
  67. }
  68. },
  69. "404": {
  70. "description": "Borrower not found",
  71. "schema": {
  72. "$ref": "#/definitions/error"
  73. }
  74. }
  75. },
  76. "security": [
  77. { "multi_key_auth": [] }
  78. ]
  79. }
  80. },
  81. "/borrowers/{borrowernumber}/issues": {
  82. "get": {
  83. "x-mojo-controller": "Koha::REST::V1::Borrowers::Issues",
  84. "operationId": "listBorrowerIssues",
  85. "tags": ["borrowers", "issues"],
  86. "parameters": [
  87. {
  88. "$ref": "#/parameters/borrowernumberPathParam"
  89. }
  90. ],
  91. "produces": [
  92. "application/json"
  93. ],
  94. "responses": {
  95. "200": {
  96. "description": "A list of issues",
  97. "schema": {
  98. "$ref": "#/definitions/issues"
  99. }
  100. },
  101. "404": {
  102. "description": "Borrower not found",
  103. "schema": {
  104. "$ref": "#/definitions/error"
  105. }
  106. }
  107. }
  108. }
  109. },
  110. "/borrowers/{borrowernumber}/issues/{itemnumber}": {
  111. "get": {
  112. "x-mojo-controller": "Koha::REST::V1::Borrowers::Issues",
  113. "operationId": "getBorrowerIssue",
  114. "tags": ["borrowers", "issues"],
  115. "parameters": [
  116. { "$ref": "#/parameters/borrowernumberPathParam" },
  117. { "$ref": "#/parameters/itemnumberPathParam" }
  118. ],
  119. "produces": ["application/json"],
  120. "responses": {
  121. "200": {
  122. "description": "Updated borrower's issue",
  123. "schema": { "$ref": "#/definitions/issue" }
  124. },
  125. "404": {
  126. "description": "Issue not found",
  127. "schema": { "$ref": "#/definitions/error" }
  128. }
  129. }
  130. },
  131. "put": {
  132. "x-mojo-controller": "Koha::REST::V1::Borrowers::Issues",
  133. "operationId": "renewBorrowerIssue",
  134. "tags": ["borrowers", "issues"],
  135. "parameters": [
  136. { "$ref": "#/parameters/borrowernumberPathParam" },
  137. { "$ref": "#/parameters/itemnumberPathParam" }
  138. ],
  139. "produces": ["application/json"],
  140. "responses": {
  141. "200": {
  142. "description": "Updated borrower's issue",
  143. "schema": { "$ref": "#/definitions/issue" }
  144. },
  145. "403": {
  146. "description": "Cannot renew issue",
  147. "schema": { "$ref": "#/definitions/error" }
  148. },
  149. "404": {
  150. "description": "Issue not found",
  151. "schema": { "$ref": "#/definitions/error" }
  152. }
  153. }
  154. }
  155. },
  156. "/borrowers/{borrowernumber}/reserves": {
  157. "get": {
  158. "x-mojo-controller": "Koha::REST::V1::Borrowers::Reserves",
  159. "operationId": "listBorrowerReserves",
  160. "tags": ["borrowers", "reserves"],
  161. "parameters": [
  162. { "$ref": "#/parameters/borrowernumberPathParam" }
  163. ],
  164. "produces": ["application/json"],
  165. "responses": {
  166. "200": {
  167. "description": "A list of reserves",
  168. "schema": { "$ref": "#/definitions/reserves" }
  169. },
  170. "404": {
  171. "description": "Borrower not found",
  172. "schema": { "$ref": "#/definitions/error" }
  173. }
  174. }
  175. },
  176. "post": {
  177. "x-mojo-controller": "Koha::REST::V1::Borrowers::Reserves",
  178. "operationId": "addBorrowerReserve",
  179. "tags": ["borrowers", "reserves"],
  180. "parameters": [
  181. { "$ref": "#/parameters/borrowernumberPathParam" },
  182. {
  183. "name": "body",
  184. "in": "body",
  185. "description": "A JSON object containing informations about the new reserve",
  186. "required": true,
  187. "schema": { "$ref": "#/definitions/newBorrowerReserveBody" }
  188. }
  189. ],
  190. "consumes": ["application/json"],
  191. "produces": ["application/json"],
  192. "responses": {
  193. "201": {
  194. "description": "Created reserve",
  195. "schema": { "$ref": "#/definitions/reserve" }
  196. },
  197. "400": {
  198. "description": "Missing or wrong parameters",
  199. "schema": { "$ref": "#/definitions/error" }
  200. },
  201. "403": {
  202. "description": "Reserve not allowed",
  203. "schema": { "$ref": "#/definitions/error" }
  204. },
  205. "404": {
  206. "description": "Borrower not found",
  207. "schema": { "$ref": "#/definitions/error" }
  208. },
  209. "500": {
  210. "description": "Internal error",
  211. "schema": { "$ref": "#/definitions/error" }
  212. }
  213. }
  214. }
  215. },
  216. "/reserves/{reserve_id}": {
  217. "put": {
  218. "x-mojo-controller": "Koha::REST::V1::Reserves",
  219. "operationId": "editReserve",
  220. "tags": ["reserves"],
  221. "parameters": [
  222. { "$ref": "#/parameters/reserveIdPathParam" },
  223. {
  224. "name": "body",
  225. "in": "body",
  226. "description": "A JSON object containing fields to modify",
  227. "required": true,
  228. "schema": { "$ref": "#/definitions/editReserveBody" }
  229. }
  230. ],
  231. "consumes": ["application/json"],
  232. "produces": ["application/json"],
  233. "responses": {
  234. "200": {
  235. "description": "Updated reserve",
  236. "schema": { "$ref": "#/definitions/reserve" }
  237. },
  238. "400": {
  239. "description": "Missing or wrong parameters",
  240. "schema": { "$ref": "#/definitions/error" }
  241. },
  242. "404": {
  243. "description": "Reserve not found",
  244. "schema": { "$ref": "#/definitions/error" }
  245. }
  246. }
  247. },
  248. "delete": {
  249. "x-mojo-controller": "Koha::REST::V1::Reserves",
  250. "operationId": "deleteReserve",
  251. "tags": ["reserves"],
  252. "parameters": [
  253. { "$ref": "#/parameters/reserveIdPathParam" }
  254. ],
  255. "produces": ["application/json"],
  256. "responses": {
  257. "204": {
  258. "description": "No content",
  259. "schema": {
  260. "type": "null"
  261. }
  262. },
  263. "404": {
  264. "description": "Reserve not found",
  265. "schema": { "$ref": "#/definitions/error" }
  266. }
  267. }
  268. }
  269. }
  270. },
  271. "definitions": {
  272. "borrower": {
  273. "type": "object",
  274. "properties": {
  275. "borrowernumber": {
  276. "$ref": "#/definitions/borrowernumber"
  277. },
  278. "cardnumber": {
  279. "description": "library assigned ID number for borrowers"
  280. },
  281. "surname": {
  282. "description": "borrower's last name"
  283. },
  284. "firstname": {
  285. "description": "borrower's first name"
  286. }
  287. }
  288. },
  289. "issues": {
  290. "type": "array",
  291. "items": {
  292. "$ref": "#/definitions/issue"
  293. }
  294. },
  295. "issue": {
  296. "type": "object",
  297. "properties": {
  298. "borrowernumber": {
  299. "$ref": "#/definitions/borrowernumber"
  300. },
  301. "itemnumber": {
  302. "$ref": "#/definitions/itemnumber"
  303. },
  304. "date_due": {
  305. "description": "Due date"
  306. },
  307. "branchcode": {
  308. "$ref": "#/definitions/branchcode"
  309. },
  310. "issuingbranch": {
  311. "description": "Code of the branch where issue was made"
  312. },
  313. "returndate": {
  314. "description": "Date the item was returned"
  315. },
  316. "lastreneweddate": {
  317. "description": "Date the item was last renewed"
  318. },
  319. "return": {
  320. "description": "?"
  321. },
  322. "renewals": {
  323. "description": "Number of renewals"
  324. },
  325. "auto_renew": {
  326. "description": "Auto renewal"
  327. },
  328. "timestamp": {
  329. "description": "Last update time"
  330. },
  331. "issuedate": {
  332. "description": "Date the item was issued"
  333. },
  334. "onsite_checkout": {
  335. "description": "On site checkout"
  336. }
  337. }
  338. },
  339. "reserves": {
  340. "type": "array",
  341. "items": { "$ref": "#/definitions/reserve" }
  342. },
  343. "reserve": {
  344. "type": "object",
  345. "properties": {
  346. "reserve_id": {
  347. "description": "Internal reserve identifier"
  348. },
  349. "borrowernumber": { "$ref" : "#/definitions/borrowernumber" },
  350. "reservedate": {
  351. "description": "the date the reserve was placed"
  352. },
  353. "biblionumber": { "$ref": "#/definitions/biblionumber" },
  354. "constrainttype": {
  355. "description": "type of constraint"
  356. },
  357. "branchcode": { "$ref": "#/definitions/branchcode" },
  358. "notificationdate": {
  359. "description": "currently unused"
  360. },
  361. "reminderdate": {
  362. "description": "currently unused"
  363. },
  364. "cancellationdate": {
  365. "description": "the date the reserve was cancelled"
  366. },
  367. "reservenotes": {
  368. "description": "notes related to this reserve"
  369. },
  370. "priority": {
  371. "description": "where in the queue the patron sits"
  372. },
  373. "found": {
  374. "description": "a one letter code defining what the status of the reserve is after it has been confirmed"
  375. },
  376. "timestamp": {
  377. "description": "date and time the reserve was last updated"
  378. },
  379. "itemnumber": { "$ref": "#/definitions/itemnumber" },
  380. "waitingdate": {
  381. "description": "the date the item was marked as waiting for the patron at the library"
  382. },
  383. "expirationdate": {
  384. "description": "the date the reserve expires"
  385. },
  386. "lowestPriority": {
  387. "description": ""
  388. },
  389. "suspend": {
  390. "description": ""
  391. },
  392. "suspend_until": {
  393. "description": ""
  394. }
  395. }
  396. },
  397. "newBorrowerReserveBody": {
  398. "type": "object",
  399. "properties": {
  400. "biblionumber": {
  401. "description": "Biblio internal identifier",
  402. "type": "integer"
  403. },
  404. "itemnumber": {
  405. "description": "Item internal identifier",
  406. "type": "integer"
  407. },
  408. "branchcode": {
  409. "description": "Pickup location",
  410. "type": "string",
  411. "required": true
  412. },
  413. "expirationdate": {
  414. "description": "Reserve end date",
  415. "type": "string",
  416. "format": "date"
  417. }
  418. }
  419. },
  420. "editReserveBody": {
  421. "type": "object",
  422. "properties": {
  423. "priority": {
  424. "description": "Position in waiting queue",
  425. "type": "integer",
  426. "minimum": 1
  427. },
  428. "branchcode": {
  429. "description": "Pickup location",
  430. "type": "string"
  431. },
  432. "suspend_until": {
  433. "description": "Suspend until",
  434. "type": "string",
  435. "format": "date"
  436. }
  437. }
  438. },
  439. "biblionumber": {
  440. "description": "Biblio internal identifier"
  441. },
  442. "borrowernumber": {
  443. "description": "Borrower internal identifier"
  444. },
  445. "branchcode": {
  446. "description": "Branch code"
  447. },
  448. "itemnumber": {
  449. "description": "Item internal identifier"
  450. },
  451. "error": {
  452. "type": "object",
  453. "properties": {
  454. "error": {
  455. "description": "Error message",
  456. "type": "string"
  457. }
  458. }
  459. }
  460. },
  461. "parameters": {
  462. "borrowernumberPathParam": {
  463. "name": "borrowernumber",
  464. "in": "path",
  465. "description": "Internal borrower identifier",
  466. "required": true,
  467. "type": "integer"
  468. },
  469. "reserveIdPathParam": {
  470. "name": "reserve_id",
  471. "in": "path",
  472. "description": "Internal reserve identifier",
  473. "required": true,
  474. "type": "integer"
  475. },
  476. "itemnumberPathParam": {
  477. "name": "itemnumber",
  478. "in": "path",
  479. "description": "Internal item identifier",
  480. "required": "true",
  481. "type": "integer"
  482. }
  483. },
  484. "securityDefinitions": {
  485. "multi_key_auth": {
  486. "type": "custom",
  487. "in": "header",
  488. "keys": {
  489. "ETag": {
  490. "type": "dateTime",
  491. "description": "The current time when the request is created."
  492. },
  493. "x-koha-username": {
  494. "type": "string",
  495. "description": "The username of the API consumer. Not the library card's barcode or borrowernumber!"
  496. },
  497. "x-koha-permission": {
  498. "type": "string",
  499. "description": "The specific permission the user must have. Eg. 'circulation => force_checkout'"
  500. },
  501. "x-koha-signature": {
  502. "type": "string",
  503. "description": "The signature is a HMAC-SHA256 hash of several elements of the request, separated by spaces: 1. HTTP method (uppercase) 2. URL path and query string 3. Value of x-koha-username -header 4. Value of the ETag-header"
  504. }
  505. }
  506. }
  507. }
  508. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement