Browse Source

Bug 22615: Add endpoint for getting one ill backend

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Josef Moravec 2 years ago
committed by Martin Renvoize
parent
commit
81655e7dbf
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 28
      Koha/REST/V1/Illbackends.pm
  2. 3
      api/v1/swagger/definitions.json
  3. 3
      api/v1/swagger/paths.json
  4. 62
      api/v1/swagger/paths/ill_backends.json

28
Koha/REST/V1/Illbackends.pm

@ -51,4 +51,32 @@ sub list {
return $c->render( status => 200, openapi => \@data );
}
=head3 get
Get one backend
=cut
sub get {
my $c = shift->openapi->valid_input;
my $backend_id = $c->validation->param('ill_backend_id');
return try {
my $backend = Koha::Illrequest->new->load_backend( $backend_id );
return $c->render(
status => 200,
openapi => {
ill_backend_id => $backend_id,
capabilities => $backend->capabilities
}
);
} catch {
return $c->render(
status => 404,
openapi => { error => "ILL backend does not exist" }
);
};
}
1;

3
api/v1/swagger/definitions.json

@ -35,6 +35,9 @@
"ill_backends": {
"$ref": "definitions/ill_backends.json"
},
"ill_backend": {
"$ref": "definitions/ill_backend.json"
},
"library": {
"$ref": "definitions/library.json"
},

3
api/v1/swagger/paths.json

@ -86,6 +86,9 @@
"/ill_backends": {
"$ref": "paths/ill_backends.json#/~1ill_backends"
},
"/ill_backends/{ill_backend_id}": {
"$ref": "paths/ill_backends.json#/~1ill_backends~1{ill_backend_id}"
},
"/illrequests": {
"$ref": "paths/illrequests.json#/~1illrequests"
},

62
api/v1/swagger/paths/ill_backends.json

@ -52,5 +52,67 @@
}
}
}
},
"/ill_backends/{ill_backend_id}": {
"get": {
"x-mojo-to": "Illbackends#get",
"operationId": "getIllbackends",
"tags": ["illbackends"],
"parameters": [
{
"name": "ill_backend_id",
"in": "path",
"description": "ILL backend id/name",
"required": true,
"type": "string"
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "An ILL backends",
"schema": {
"$ref": "../definitions.json#/ill_backend"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "ILL backends not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"ill": "1"
}
}
}
}
}

Loading…
Cancel
Save