View | Details | Raw Unified | Return to bug 22615
Collapse All | Expand All

(-)a/Koha/REST/V1/Illbackends.pm (+28 lines)
Lines 51-54 sub list { Link Here
51
    return $c->render( status => 200, openapi => \@data );
51
    return $c->render( status => 200, openapi => \@data );
52
}
52
}
53
53
54
=head3 get
55
56
Get one backend
57
58
=cut
59
60
sub get {
61
    my $c = shift->openapi->valid_input;
62
63
    my $backend_id = $c->validation->param('ill_backend_id');
64
65
    return try {
66
        my $backend = Koha::Illrequest->new->load_backend( $backend_id );
67
        return $c->render(
68
            status => 200,
69
            openapi => {
70
                ill_backend_id => $backend_id,
71
                capabilities => $backend->capabilities
72
            }
73
        );
74
    } catch {
75
        return $c->render(
76
            status => 404,
77
            openapi => { error => "ILL backend does not exist" }
78
        );
79
    };
80
}
81
54
1;
82
1;
(-)a/api/v1/swagger/definitions.json (+3 lines)
Lines 32-37 Link Here
32
  "ill_backends": {
32
  "ill_backends": {
33
    "$ref": "definitions/ill_backends.json"
33
    "$ref": "definitions/ill_backends.json"
34
  },
34
  },
35
  "ill_backend": {
36
    "$ref": "definitions/ill_backend.json"
37
  },
35
  "library": {
38
  "library": {
36
    "$ref": "definitions/library.json"
39
    "$ref": "definitions/library.json"
37
  },
40
  },
(-)a/api/v1/swagger/paths.json (+3 lines)
Lines 83-88 Link Here
83
  "/ill_backends": {
83
  "/ill_backends": {
84
    "$ref": "paths/ill_backends.json#/~1ill_backends"
84
    "$ref": "paths/ill_backends.json#/~1ill_backends"
85
  },
85
  },
86
  "/ill_backends/{ill_backend_id}": {
87
    "$ref": "paths/ill_backends.json#/~1ill_backends~1{ill_backend_id}"
88
  },
86
  "/illrequests": {
89
  "/illrequests": {
87
    "$ref": "paths/illrequests.json#/~1illrequests"
90
    "$ref": "paths/illrequests.json#/~1illrequests"
88
  },
91
  },
(-)a/api/v1/swagger/paths/ill_backends.json (-1 / +62 lines)
Lines 52-56 Link Here
52
                }
52
                }
53
            }
53
            }
54
        }
54
        }
55
    },
56
    "/ill_backends/{ill_backend_id}": {
57
        "get": {
58
            "x-mojo-to": "Illbackends#get",
59
            "operationId": "getIllbackends",
60
            "tags": ["illbackends"],
61
            "parameters": [
62
                {
63
                    "name": "ill_backend_id",
64
                    "in": "path",
65
                    "description": "ILL backend id/name",
66
                    "required": true,
67
                    "type": "string"
68
                }
69
            ],
70
            "produces": [
71
                "application/json"
72
            ],
73
            "responses": {
74
                "200": {
75
                    "description": "An ILL backends",
76
                    "schema": {
77
                        "$ref": "../definitions.json#/ill_backend"
78
                    }
79
                },
80
                "401": {
81
                  "description": "Authentication required",
82
                  "schema": {
83
                    "$ref": "../definitions.json#/error"
84
                  }
85
                },
86
                "403": {
87
                  "description": "Access forbidden",
88
                  "schema": {
89
                    "$ref": "../definitions.json#/error"
90
                  }
91
                },
92
                "404": {
93
                  "description": "ILL backends not found",
94
                  "schema": {
95
                    "$ref": "../definitions.json#/error"
96
                  }
97
                },
98
                "500": {
99
                  "description": "Internal server error",
100
                  "schema": {
101
                    "$ref": "../definitions.json#/error"
102
                  }
103
                },
104
                "503": {
105
                  "description": "Under maintenance",
106
                  "schema": {
107
                    "$ref": "../definitions.json#/error"
108
                  }
109
                }
110
            },
111
            "x-koha-authorization": {
112
                "permissions": {
113
                    "ill": "1"
114
                }
115
            }
116
        }
55
    }
117
    }
56
}
118
}
57
- 

Return to bug 22615