Skip to content
Snippets Groups Projects
Commit bd0c8d45 authored by srosse's avatar srosse
Browse files

OO-4096: remove old documentation of the REST API

parent 7a36fd86
No related branches found
No related tags found
No related merge requests found
Showing
with 11 additions and 32506 deletions
...@@ -93,8 +93,6 @@ public class RestapiAdminController extends FormBasicController { ...@@ -93,8 +93,6 @@ public class RestapiAdminController extends FormBasicController {
layoutContainer.add(docLinkFlc); layoutContainer.add(docLinkFlc);
docLinkFlc.setVisible(restEnabled); docLinkFlc.setVisible(restEnabled);
String link = Settings.getServerContextPathURI() + RestSecurityHelper.SUB_CONTEXT + "/api/doc";
docLinkFlc.contextPut("docLink", link);
String openApiLink = Settings.getServerContextPathURI() + RestSecurityHelper.SUB_CONTEXT + "/openapi.json"; String openApiLink = Settings.getServerContextPathURI() + RestSecurityHelper.SUB_CONTEXT + "/openapi.json";
docLinkFlc.contextPut("openApiLink", openApiLink); docLinkFlc.contextPut("openApiLink", openApiLink);
String swaggerUiLink = Settings.getServerContextPathURI() + RestSecurityHelper.SUB_CONTEXT + "/api-docs/?url=" String swaggerUiLink = Settings.getServerContextPathURI() + RestSecurityHelper.SUB_CONTEXT + "/api-docs/?url="
......
<p>$r.translate("rest.doc"): <a href="$docLink" target="_blanck">$docLink <i class="o_icon o_icon_content_popup"> </i></a><p><h5><i class="o_icon o_icon_warn"> </i> $r.translate("rest.doc.openapi.experimental")</h5><p>$r.translate("rest.doc.openapi"): <a href="$openApiLink" target="_blanck">$openApiLink <i class="o_icon o_icon_code"> </i></a><br>$r.translate("rest.doc.swagger.ui"): <a href="$swaggerUiLink" target="_blanck">$swaggerUiLink <i class="o_icon o_icon_content_popup"> </i></a></p> <h5>$r.translate("rest.doc.openapi.title")</h5>
\ No newline at end of file <p>$r.translate("rest.doc.swagger.ui"): <a href="$swaggerUiLink" target="_blanck">$swaggerUiLink <i class="o_icon o_icon_content_popup"> </i></a><br>$r.translate("rest.doc.openapi"): <a href="$openApiLink" target="_blanck">$openApiLink <i class="o_icon o_icon_code"> </i></a></p>
\ No newline at end of file
#Mon Mar 02 09:54:03 CET 2009 #Mon Mar 02 09:54:03 CET 2009
rest.doc=Dokumentation rest.doc=Dokumentation
rest.doc.openapi=Raw JSON rest.doc.openapi=Raw JSON
rest.doc.openapi.experimental=Experimental Dokumentation OpenAPI 3.0 rest.doc.openapi.title=Dokumentation OpenAPI 3.0
rest.doc.swagger.ui=SwaggerUI rest.doc.swagger.ui=Pretty Doku mit SwaggerUI
rest.title=REST API rest.title=REST API
rest.intro=Die REST API macht viele OLAT-Funktionalit\u00E4ten f\u00FCr andere Systeme zug\u00E4nglich. Es ist u.a. m\u00F6glich, Benutzer und Lerngruppen zu verwalten, Kurse zu importieren und Kataloge zu f\u00FChren. rest.intro=Die REST API macht viele OLAT-Funktionalit\u00E4ten f\u00FCr andere Systeme zug\u00E4nglich. Es ist u.a. m\u00F6glich, Benutzer und Lerngruppen zu verwalten, Kurse zu importieren und Kataloge zu f\u00FChren.
rest.enabled=REST API Zugang rest.enabled=REST API Zugang
......
...@@ -43,8 +43,8 @@ managed.repo=Managed learning resources ...@@ -43,8 +43,8 @@ managed.repo=Managed learning resources
managed.user.portrait=Managed user portrait managed.user.portrait=Managed user portrait
rest.doc=Documentation rest.doc=Documentation
rest.doc.openapi=Raw JSON rest.doc.openapi=Raw JSON
rest.doc.openapi.experimental=Experimental documentation OpenAPI 3.0 rest.doc.openapi.experimental=Documentation OpenAPI 3.0
rest.doc.swagger.ui=SwaggerUI rest.doc.swagger.ui=Pretty docu with SwaggerUI
rest.enabled=Access REST API rest.enabled=Access REST API
rest.intro=REST API makes various OLAT features accessible to other systems. It is e.g. possible to manage users and learning groups, import courses, or assemble catalogs. rest.intro=REST API makes various OLAT features accessible to other systems. It is e.g. possible to manage users and learning groups, import courses, or assemble catalogs.
rest.on=on rest.on=on
......
...@@ -43,8 +43,8 @@ managed.repo=Ressources didactiques g\u00E9r\u00E9es ...@@ -43,8 +43,8 @@ managed.repo=Ressources didactiques g\u00E9r\u00E9es
managed.user.portrait=Image publi\u00E9e g\u00E9r\u00E9e managed.user.portrait=Image publi\u00E9e g\u00E9r\u00E9e
rest.doc=Documentation rest.doc=Documentation
rest.doc.openapi=JSON brute rest.doc.openapi=JSON brute
rest.doc.openapi.experimental=Documentation exp\u00E9rimentale OpenAPI 3.0 rest.doc.openapi.experimental=Documentation OpenAPI 3.0
rest.doc.swagger.ui=SwaggerUI rest.doc.swagger.ui=Documentation sympa avec SwaggerUI
rest.enabled=Acc\u00E8s REST API rest.enabled=Acc\u00E8s REST API
rest.intro=REST API rend accessibles de nombreuses fonctionnalit\u00E9s OLAT pour d'autres syst\u00E8mes. Par exemple, il est possible de g\u00E9rer des utilisateurs et des groupes d'\u00E9tude, d'importer des cours et de g\u00E9rer des catalogues. rest.intro=REST API rend accessibles de nombreuses fonctionnalit\u00E9s OLAT pour d'autres syst\u00E8mes. Par exemple, il est possible de g\u00E9rer des utilisateurs et des groupes d'\u00E9tude, d'importer des cours et de g\u00E9rer des catalogues.
rest.on=activ\u00E9 rest.on=activ\u00E9
......
...@@ -43,8 +43,8 @@ managed.repo=Recursos did\u00E1ticos gerenciados ...@@ -43,8 +43,8 @@ managed.repo=Recursos did\u00E1ticos gerenciados
managed.user.portrait=Retrato de usu\u00E1rio gerenciado managed.user.portrait=Retrato de usu\u00E1rio gerenciado
rest.doc=Documenta\u00E7\u00E3o rest.doc=Documenta\u00E7\u00E3o
rest.doc.openapi=Raw JSON rest.doc.openapi=Raw JSON
rest.doc.openapi.experimental=Documenta\u00E7\u00E3o Experimental OpenAPI 3.0 rest.doc.openapi.experimental=Documenta\u00E7\u00E3o OpenAPI 3.0
rest.doc.swagger.ui=SwaggerUI rest.doc.swagger.ui=Documenta\u00E7\u00E3o SwaggerUI
rest.enabled=Acesse REST API rest.enabled=Acesse REST API
rest.intro=A REST API faz v\u00E1rios recursos do OLAT acess\u00EDveis a outros sistemas. \u00C9 poss\u00EDvel, por exemplo gerenciar usu\u00E1rios e grupos de estudo, importar cursos, ou montar cat\u00E1logos. rest.intro=A REST API faz v\u00E1rios recursos do OLAT acess\u00EDveis a outros sistemas. \u00C9 poss\u00EDvel, por exemplo gerenciar usu\u00E1rios e grupos de estudo, importar cursos, ou montar cat\u00E1logos.
rest.on=um rest.on=um
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.restapi.api;
import java.io.InputStream;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.springframework.stereotype.Component;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
*
* Description:<br>
* Service for general informations on the OLAT REST Api.
*
* <P>
* Initial Date: 14 apr. 2010 <br>
* @author srosse, stephane.rosse@frentix.com
*/
@Tag(name = "API")
@Path("api")
@Component
public class ApiWebService {
private String VERSION = "1.0";
private String COPYRIGHT = "OpenOLAT - infinite learning\nhttp://www.openolat.org\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\nSee the License for the specific language governing permissions and\\nlimitations under the License.\n\nCopyright (c) frentix GmbH\nhttp://www.frentix.com";
/**
* Version number of the whole REST API of OLAT.
* @response.representation.200.mediaType text/plain
* @response.representation.200.doc Return the version number
* @response.representation.200.example 1.0
* @return The version number
*/
@GET
@Path("version")
@Operation(summary = "Version number of the whole REST API of OLAT", description = "Version number of the whole REST API of OLAT")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "Return the version number") })
@Produces(MediaType.TEXT_PLAIN)
public Response getVersion() {
return Response.ok(VERSION).build();
}
@GET
@Path("doc")
@Operation(summary = "Get the doc", description = "Get the doc")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "Return the doc") })
@Produces(MediaType.TEXT_HTML)
public Response getHtmlDoc() {
InputStream in = ApiWebService.class.getResourceAsStream("_content/application.html");
if(in == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
return Response.ok(in).build();
}
/**
* Returns images for the documentation of OLAT.
* @response.representation.200.mediaType image/jpeg
* @response.representation.200.doc Images for the documentation
* @return Images
*/
@GET
@Path("doc/{filename}")
@Operation(summary = "Returns images for the documentation of OLAT", description = "Returns images for the documentation of OLAT")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "Images for the documentation") })
@Produces("image/jpeg")
public Response getImage1(@PathParam("filename") String filename) {
InputStream in = ApiWebService.class.getResourceAsStream("_content/" + filename);
if(in == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
return Response.ok(in).build();
}
/**
* Returns images for the documentation of OLAT.
* @response.representation.200.mediaType image/jpeg
* @response.representation.200.doc Images for the documentation
* @return Images
*/
@GET
@Path("{filename}")
@Operation(summary = "Returns images for the documentation of OLAT", description = "Returns images for the documentation of OLAT")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "Images for the documentation") })
@Produces("image/jpeg")
public Response getImage2(@PathParam("filename") String filename) {
InputStream in = ApiWebService.class.getResourceAsStream("_content/" + filename);
return Response.ok(in).build();
}
/**
* Returns the copyright of OLAT.
* @response.representation.200.mediaType text/html, application/xhtml+xml
* @response.representation.200.doc The copyright of the REST API.
* @return The copyright
*/
@GET
@Path("copyright")
@Operation(summary = "Returns the copyright of OLAT", description = "Returns the copyright of OLAT")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "The copyright of the REST API") })
@Produces({MediaType.APPLICATION_XHTML_XML, MediaType.TEXT_HTML})
public Response getCopyrightXhtml() {
StringBuilder sb = new StringBuilder();
sb.append("<html><head><title>OLAT Copyright</title></head><body><p>");
sb.append(COPYRIGHT.replace("\n\n", "</p><p>"));
sb.append(COPYRIGHT.replace("\n", "<br />"));
sb.append("</p></body></html>");
return Response.ok(sb.toString()).build();
}
/**
* Returns the copyright of OLAT.
* @response.representation.200.mediaType text/plain
* @response.representation.200.doc The copyright of the REST API.
* @return The copyright
*/
@GET
@Path("copyright")
@Operation(summary = "Returns the copyright of OLAT", description = "Returns the copyright of OLAT")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "The copyright of the REST API") })
@Produces({MediaType.TEXT_PLAIN})
public Response getCopyrightPlainText() {
return Response.ok(COPYRIGHT).build();
}
}
\ No newline at end of file
source diff could not be displayed: it is too large. Options to address this: view the blob.
src/main/java/org/olat/restapi/api/_content/schema.jpg

55.6 KiB

...@@ -134,7 +134,7 @@ public class RestApiLoginFilterTest extends OlatRestTestCase { ...@@ -134,7 +134,7 @@ public class RestApiLoginFilterTest extends OlatRestTestCase {
//path is not protected //path is not protected
RestConnection c3 = new RestConnection(); RestConnection c3 = new RestConnection();
URI uri3 = UriBuilder.fromUri(getContextURI()).path("/api/copyright").build(); URI uri3 = UriBuilder.fromUri(getContextURI()).path("/ping").build();
HttpGet method3 = c3.createGet(uri3, MediaType.TEXT_PLAIN, false); HttpGet method3 = c3.createGet(uri3, MediaType.TEXT_PLAIN, false);
method3.setHeader(RestSecurityHelper.SEC_TOKEN, securityToken); method3.setHeader(RestSecurityHelper.SEC_TOKEN, securityToken);
HttpResponse r3 = c3.execute(method3); HttpResponse r3 = c3.execute(method3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment