Skip to content

Commit 70bb3ef

Browse files
committed
Updated documentation for REST webservices
1 parent ecbf2b4 commit 70bb3ef

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

logicaldoc-webservice/src/main/java/com/logicaldoc/webservice/rest/endpoint/RestAuthService.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
import com.logicaldoc.webservice.soap.endpoint.SoapAuthService;
2323

2424
import io.swagger.v3.oas.annotations.Operation;
25+
import io.swagger.v3.oas.annotations.media.Content;
26+
import io.swagger.v3.oas.annotations.media.Schema;
27+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
28+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
2529
import io.swagger.v3.oas.annotations.tags.Tag;
2630

2731
@Path("/")
@@ -35,9 +39,8 @@ public class RestAuthService extends SoapAuthService implements AuthService {
3539
@GET
3640
@Path("/login")
3741
@Override
38-
public String login(@QueryParam("u")
39-
String username, @QueryParam("pw")
40-
String password) throws AuthenticationException {
42+
public String login(@QueryParam("u") String username, @QueryParam("pw") String password)
43+
throws AuthenticationException {
4144
return super.login(username, password);
4245
}
4346

@@ -46,9 +49,7 @@ public String login(@QueryParam("u")
4649
@Operation(operationId = "loginForm", summary = "Login with POST", description = "Deprecated, use loginApiKey instead")
4750
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
4851
@Override
49-
public String loginForm(@FormParam("username")
50-
String username, @FormParam("password")
51-
String password) {
52+
public String loginForm(@FormParam("username") String username, @FormParam("password") String password) {
5253
return super.login(username, password);
5354
}
5455

@@ -63,9 +64,12 @@ public String loginPostJSON(WSCredentials cred) {
6364

6465
@GET
6566
@Path("/loginApiKey")
67+
@Operation(summary = "Login by API Key", description = "Performs login by passing the API Key in the header. Read more at https://docs.logicaldoc.com/en/web-services-api/api-keys")
68+
@ApiResponses(value = {
69+
@ApiResponse(responseCode = "200", description = "Successful operation. The Session ID (sid) is returned.", content = @Content(schema = @Schema(implementation = String.class, description = "The session ID (sid) created", example = "ca3c411d-b043-49a3-b151-e363dddcecef"))),
70+
@ApiResponse(responseCode = "500", description = "Authentication failed")})
6671
@Override
67-
public String loginApiKey(@HeaderParam("X-API-KEY")
68-
String apikey) {
72+
public String loginApiKey(@HeaderParam("X-API-KEY") String apikey) {
6973
// The header was already processed by the SessionFilter so we must
7074
// check the existing session first
7175
String sid = SessionManager.get().getSessionId(getCurrentRequest());

logicaldoc-webservice/src/main/java/com/logicaldoc/webservice/rest/endpoint/RestDocumentService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,11 @@ public String deleteVersion(@QueryParam("docId")
421421
@PUT
422422
@Path("/update")
423423
@Operation(summary = "Updates an existing document", description = "Updates the metadata of an existing document. The ID of the document must be specified in the WSDocument value object. The provided example moves document with ID 1111111 to folder 3435433")
424+
@ApiResponses(value = {
425+
@ApiResponse(responseCode = "204", description = "Successful operation"),
426+
@ApiResponse(responseCode = "401", description = "Operation failed, authentication error. See system logs"),
427+
@ApiResponse(responseCode = "406", description = "Operation failed, the server could not produce a response matching the list of acceptable values defined in the request"),
428+
@ApiResponse(responseCode = "500", description = "Operation failed, there may be a problem with the data provided for the update. Please see system logs")})
424429
public void update(
425430
@Parameter(description = "Document object that needs to be updated", required = true, example = "{ \"id\": 1111111, \"folderId\": 3435433 }")
426431
WSDocument document) throws AuthenticationException, PermissionException, WebserviceException,

0 commit comments

Comments
 (0)