This documentation supports the 21.02 version of BMC Helix Innovation Studio.To view an earlier version, select the version from the Product version menu.

Creating a custom REST resource


You can create a new REST-based resource using BMC Helix Innovation Studio. The REST resource you create can support all the standard HTTP operations (GET, PUT, POST and DELETE).

  1. Create a Java class that implements RestfulResource interface (com.bmc.arsys.rx.services.common.RestfulResource). RestfulResource is a Marker interface.
    For example:

    /**
     * JAX-RS Resource for handling requests
    related to Login Content. The class uses jersey specific
     * implementation of Multi-Part. There is a
    request for providing portable attachment support in
     * JAX-RS please refer
    https://java.net/jira/browse/JAX_RS_SPEC-413
     */

    @Path("rx/application/logincontent")
    public
    class LoginContentResource
    implements RestfulResource {
      …
    }


    @GET
        @Path("/favicon.ico")
       public Response getLoginFavicon(@Context HttpHeaders httpHeaders)
    {
           try {
               byte[] faviconContent = getLoginContentService().getFavicon(getHostName(httpHeaders));
               if (faviconContent != null) {
                   StreamingOutput stream = new
    StreamingOutput() {
                        @Override
                       public void
    write(OutputStream outputStream) throws IOException,
                         
    WebApplicationException {
                        
    outputStream.write(faviconContent);

                }

         };

             return Response.ok(stream,
             MediaType.valueOf(LoginContentService.FAVICON_MEDIA_TYPE)).build();

              } else {
                   return Response.ok().build();
              }
           } catch (RxException exception) {
      … throw exception;
            }
        }

    Annotation @Path describes the URL prefix.

  2. Register the resource class in the bundle class (in activator start method). 
  3. Compile the code using Maven. 
  4. Deploy the REST resource using the following command:

    mvn clean install -Pexport -Pdeploy

You can test the REST resource using POSTMAN.

Related topics

PDFs-videos-and-API-documentation

Creating-a-DataPageQuery-REST-interface

Creating-a-command-REST-interface

Handling-exceptions

Login-information

Enabling-and-downloading-logs-from-BMC-Helix-Innovation-Studio

Enabling-browser-logging-in-a-Digital-Service-application

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*