cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
Description
Shifting between external sources that are based on different scripting languages is not an easy task. When there is a requirement to query a secured widget's data to an external source (Such as JQuery, JavaScript,HTTP etc.), you will need to utilize the REST API. 
A quick example will be grabbing a widget's data to a public website or a customized company's mail report.
Prerequisites 
  1. Sisense Admin permission
  2. REST API Access 
  3. ElastiCube and linked dashboard with widgets
  4. PostMan application installed - https://www.getpostman.com/apps
  5. Granted access to the machine (IP) that is going to execute the API request against the Sisense Server - Check that the dashboard is accessible from the external machine that execute the API request.
Steps
a. Widget's JAQL Preparation and Save it
  1. Make the the JAQL code as short as possible by "starring" the formulas that are used in the widget - https://docs.sisense.com/main/SisenseLinux/reusing-formulas.htm
  2. To get the widget's JAQL code - Edit Widget > Click on F12 to open developer tools > Open Console > Clear Content > type -
    prism.debugging.GetJaql(prism.activeWidget).replace(/(\r\n|\n|\r|\t)/gm, "");
    and then hit enter
3. Copy the JAQL code to notepad - without the quotes
b. Create the Curl and URL Request 
      1. Go to the Admin Page > Click on REST API reference > Open REST API 0.9 (top right of the screen)
      2. Go to - Post> elasticubes/{elasticube}/jaql
      3. Copy the JAQL code into the request's body 
      4. Copy the ElastiCube ID from the JAQL code (data source section) into the ElastiCube input without the quotes. For example:
5. Hit Run and validate the response. A correct response will appear in bottom:
6. Copy the Curl and Request URL to notepad: 
c. Create authentication token to query the ElastiCube
      1. Go to the Admin Page > Click on REST API reference >  Open REST API 1.0 (top right of the screen)
      2. Go to - Post> authentication/login
      3. Insert your username/password and hit execute 
4. Copy the given access token from the response section without quotes to notepad 
d. Generate the Final API Request 
         1. Open PostMan and create a new POST request
         2. Enter the Request URL - Place Sisense Request URL and ElastiCube ID taken from the step B.
         3. Copy the the body tab (choose raw option) the entire JAQL code from step A.
4. Open Authorization tab > choose Bearer type > Insert your authentication token from Step C.
5. Open Headers section and add:
Content-Type, application/json 
Accept, application/json
6. Hit send to get the API call response that will include your widget data values
Response Example:
7. Click on "code" (right side of the page), to covert the API request to any scripting language that is required.
Comments
vishalbhomia89
8 - Cloud Apps
8 - Cloud Apps

Hi @intapiuser ,

I am also doing something similar, but can not find the endpoint where we are querying the JAQL.

The /api/elasticube/<id>/jaql does not exist for me. If I go to the admin page I can not see that under REST API. Am  missing something?

Version history
Last update:
‎02-13-2024 11:36 AM
Updated by:
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: