Illbackends endpoint RFC

From Koha Wiki
Jump to navigation Jump to search

This RFC is a proposal to create endpoint working with ILL backends Bug 22615

Actions and routes

The following table present the proposed endpoint definitions

Description Action Proposed path
List ILL backends
 GET
 /ill_backends
Get an ILL backend
 GET
 /ill_backends/{ill_backend_id}

ILL backend object definition

Voted on Development_IRC_meeting_10_April_2019

Proposed schema
ill_backend_id
capabilities

There is question how to represent capabilities, in proposed patch, it is implemented as raw result of $backend->capabilities. You can see how the returned structure looks in this commment: Bug 22615, Comment 5

The structure of capabilities is JSON object, where every possible action is object keyed by action id and with these parameters:

Name Description
id Action ID
method ILL backend method
name Human readable name of action
next_actions Array of possible next actions
prev_actions Array of possible previous actions
ui_method_icon Icon class from Font Awesome which should be used in UI
ui_method_name Label of UI element used for triggering this action


Example:

{
	"CANCREQ": {
		"id": "CANCREQ",
		"method": 0,
		"name": "Cancellation requested",
		"next_actions": ["KILL", "REQ", "MIG"],
		"prev_actions": ["NEW"],
		"ui_method_icon": 0,
		"ui_method_name": 0
	},
	"COMP": {
		"id": "COMP",
		"method": "mark_completed",
		"name": "Completed",
		"next_actions": [],
		"prev_actions": ["REQ"],
		"ui_method_icon": "fa-check",
		"ui_method_name": "Mark completed"
	},
	"EDITITEM": {
		"id": "EDITITEM",
		"method": "edititem",
		"name": "Edited item metadata",
		"next_actions": [],
		"prev_actions": ["NEW"],
		"ui_method_icon": "fa-edit",
		"ui_method_name": "Edit item metadata"
	},
	"GENREQ": {
		"id": "GENREQ",
		"method": "generic_confirm",
		"name": "Requested from partners",
		"next_actions": ["COMP", "MIG"],
		"prev_actions": ["NEW", "REQREV", "MIG"],
		"ui_method_icon": "fa-send-o",
		"ui_method_name": "Place request with partners"
	},
	"KILL": {
		"id": "KILL",
		"method": "delete",
		"name": 0,
		"next_actions": [],
		"prev_actions": ["QUEUED", "REQREV", "NEW", "CANCREQ", "MIG"],
		"ui_method_icon": "fa-trash",
		"ui_method_name": "Delete request"
	},
	"MIG": {
		"id": "MIG",
		"method": "migrate",
		"name": "Switched provider",
		"next_actions": ["REQ", "GENREQ", "KILL", "MIG"],
		"prev_actions": ["NEW", "REQ", "GENREQ", "REQREV", "QUEUED", "CANCREQ", "MIG"],
		"ui_method_icon": "fa-search",
		"ui_method_name": "Switch provider"
	},
	"NEW": {
		"id": "NEW",
		"method": "create",
		"name": "New request",
		"next_actions": ["REQ", "GENREQ", "KILL", "MIG", "EDITITEM"],
		"prev_actions": [],
		"ui_method_icon": "fa-plus",
		"ui_method_name": "New request"
	},
	"QUEUED": {
		"id": "QUEUED",
		"method": 0,
		"name": "Queued request",
		"next_actions": ["REQ", "KILL", "MIG"],
		"prev_actions": [],
		"ui_method_icon": 0,
		"ui_method_name": 0
	},
	"REQ": {
		"id": "REQ",
		"method": "confirm",
		"name": "Requested",
		"next_actions": ["REQREV", "COMP", "MIG"],
		"prev_actions": ["NEW", "REQREV", "QUEUED", "CANCREQ", "MIG"],
		"ui_method_icon": "fa-check",
		"ui_method_name": "Confirm request"
	},
	"REQREV": {
		"id": "REQREV",
		"method": "cancel",
		"name": "Request reverted",
		"next_actions": ["REQ", "GENREQ", "KILL", "MIG"],
		"prev_actions": ["REQ"],
		"ui_method_icon": "fa-times",
		"ui_method_name": "Revert Request"
	}
}

Notes