Configuring the Web-hook URL in Sigma Application

A Web-hook is a mechanism enables Sigma application to send report file to another application whenever a certain event occurs (Running a Report). It operates as a lightweight API where the source application makes a RESTful request (usually a POST) to a specified URL when the event triggers.

To configure the web-hook URL with the Sigma Application proceed with the following steps:

  1. Locate the Sigmainforeportconfig.properties file in your Sigma WAR package.

  2. Add or modify the property RPT_PUBLISH_WEB_HOOK_URL with the appropriate web-hook URL value.

Note: Ensure that the URL provided is correct and points to the desired endpoint where the web-hook will send data.

RPT_PUBLISH_WEB_HOOK_URL = {your-webhook-url}

To consume the web-hook in the end application, proceed with the following steps:

  1. Add Jersey MultiPartFeature in web.xml file of end-user application.

Jersey, a RESTful web service framework, provides the ability to handle multi-part form data, which is commonly used when processing file uploads or receiving complex data via webhooks.

  1. Create the web-hook API endpoint that can handle incoming web hook requests. Below is a sample implementation of a method that consumes a webhook.

Note: This example uses a POST method to handle the webhook and process an uploaded file (PDF) along with additional report details.

@POST @Path("/Test") @Produces(MediaType.APPLICATION_JSON) @Consumes({MediaType.MULTIPART_FORM_DATA}) public Response uploadPdfFile( @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileMetaData, @FormDataParam("reportDetails") String reportDetails) throws Exception { String UPLOAD_PATH = ""; try { int read = 0; byte[] bytes = new byte[1024]; OutputStream out = new FileOutputStream(new File(UPLOAD_PATH + fileMetaData.getFileName())); while ((read = fileInputStream.read(bytes)) != -1) { out.write(bytes, 0, read); } out.flush(); out.close(); } catch (IOException e) { return Response.ok("Data uploaded successfully !!").build(); }

 

 

 

Â