Get Widget’s Values Directly From The ElastiCube (API Request)
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 Sisense Admin permission REST API Access ElastiCube and linked dashboard with widgets PostMan application installed - https://www.getpostman.com/apps 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 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 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.2.2KViews0likes2CommentsREST API - Adding Data Level Security
When building code to automate the process of adding users (or groups), it may be beneficial to add security around those users. Follow the steps below to learn how to add data level security through the REST API: Step 1 From your SiSense home page, navigate to the Manage tab and choose the option for REST API. From here, click on the link to the REST API Reference interface. Step 2 From here, choose the 0.9 version and expand the Elasticube section and scroll down to the POST /elasticubes/datasecurity section. Step 3 The sample code below shows a valid JSON object to use as part of the REST API request. Starting from the sample code, replace the value for party with a user identifier that already exists in your system. Then paste the code into the REST API interface and click run. You should see a response of 200, which indicates a successful operation. [{ "server": "LocalHost", "elasticube": "Sample Lead Generation", "table": "Lead Generation", "column": "Country", "datatype": "text", "shares": [{ "party": "5c0f85690ca2f66cc242e266", "type": "user" }], "members": [ "United States", "England" ] }] Notes The server name value is case sensitive, so make sure it matches with your system. The sample provided is specific to one of the sample databases that comes with SiSense. To modify this to a different system, just update necessary fields to include your specifications. The sample provided is an array that consists of a single element. This could be modified to contain several entries all sent at once.1.8KViews1like2CommentsUsing the Datasources API to Execute SQL Query and Download Data into a Python Dataframe
This article guides how to use the Datasources API to execute an SQL query and download data from a cube into a Python data frame. The issue arises when a user cannot find the API in the REST API tab and encounters difficulties in downloading the data into a Python data frame.2.2KViews1like0CommentsBeginner Sisense REST API Tips
Three tips for new users working with Sisense's REST API for the first time. 1. If you're running API calls through our Swagger UI (ie, by going to Admin -> REST API -> REST API Reference), you do not need to generate and pass an authentication token. You only need the token when running a call from an outside application. 2. If you receive a 500 response code with an error message of "Internal Server Error" to your POST/PATCH call, that typically indicates there is a syntax error in the payload. To confirm and troubleshoot this, use an online JSON validator (such as JSONLint - https://jsonlint.com/) to review your syntax and identify errors. 3. If you're incorporating our REST API within a program, one tip to accelerate the development process is to use a third-party API tool such as Postman. You can copy the cURL our Swagger UI outputs and paste it in Postman (Import -> Paste Raw Text) to build your API call - just add the Authentication header before running. Once you've verified your call is set up correctly, click Code, then select your language from the dropdown. This will automatically give you a script for the API call in your language.1.9KViews1like1CommentMoving Your Data Security From A Cube To A Set
In some cases you would like to move a cube that has data security on it to a set, doing that will require recreating all of the data security from scratch. Easy solution is to take the data security from the old cube and modify it that it will work with the set 1. Open your Admin page > Rest API > v0.9 2. Run the Get > GET /elasticubes/{server}/{elasticube}/datasecurity 3. Take the response body and paste it in notepad++ 4. Run the following replaces commands to clean your script - Make sure you on "Regular expression" and "Wrap around" Replace .*"_id":.* With Empty Replace .*"cubeId":.* With Empty Replace .*"server":.* With Empty Replace partyId With party 5. Once this is done check if you don't have an extra comma in the end of the script and run the script in a JS Validator to make sure there are no errors. 6. Run the POST /elasticubes/{server}/{elasticube}/datasecurity with the set name and the script1KViews0likes0CommentscURL API usage
There are various ways to send API call commands in Sisense, the two basic common ways we use today are: Admin UI Swagger interface Postman Another common way we could encounter, is the need of assistance in using cURL commands. How to extract Curl from PostMan: Here I ran a successful API call using PostMan, so I know I have open communication, the syntax is working as expected and my authorization key is correct. This is how to extract the Curl equivalent: Choosing the cURL will display the code: Note - There are a few parameters which are specific for PostMan and we do not require and should be removed: Cache control, Postman-token and content-type. Result: After beautifying the code, this is a final example of a successful cURL build command: curl -X POST -H "Accept: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiNTY4YmY2NWNkNmU3MWYyMGM4MzAxOTU4IiwiYXBpU2VjcmV0IjoiODgyYjRiY2MtZmNiYy05YmM0LWUwNWUtNTFiMjhjYjgxYTVlIiwiaWF0IjoxNDc4NzY3MzU4fQ.gpPEM61R-Oeqip0pr6qkjeo4TvpSLtBbgxYpnzYAhTs" -d ' ' "http://localhost:8081/api/elasticubes/localhost/Latet/startBuild?type=Entire" A bit on cURL logic: curl - required to identify the call format -X - Defines the call, POST / GET / PATCH / DELETE -H - Inserts the values to the Header -d - Inserts the body content, if there is no body it's still essential to have empty ' ' set up per the example above. Once all the parameters are configured, the actual URL command is inserted. If you're not sure which URL the request is being sent to, you can either check the web network, or review the URL from our Swagger UI: Note that also Curl is available in the UI, but it does not contain the authentication key and -d parameters so it will not work straight forward when being copied from our web.1KViews0likes0CommentsHierarchies API
Disclaimer: This is not a documented endpoint and thus might be changed in future versions. If this does not work, do not bother filing a support ticket. This is unsupported behavior. This API overview was generated based on L8.2.1. Your mileage may vary. Get Hierarchies GET /api/elasticubes/hierarchies?elasticube=<elasticube title>&server=localhost Sample Return: Add a new level to an existing hierarchy POST /api/elasticubes/localhost/<cube title>/hierarchies/<hierarchy id>/level Sample Payload Delete Hierachy DELETE /api/elasticubes/localhost/<cube title>/hierarchies/<hierarchy id> Create new hierarchy POST /api/elasticubes/localhost/<cube title/hierarchies To attach a hierarchy you must manually update the widget with the hierarchy and update the widget This is the modification: widget_json["metadata"]["panels"][0]["items"][i]["hierarchies"] = [<hierarchy id>,....] i = Which dimension you want to attach the category to, 0 being the top dimension The assignment is an array of hierarchy ids921Views0likes0CommentsManage Color Palettes
Introduction This step-by-step article explains how to change the color palette so that you can use custom colors for elements of the Sisense dashboards. (This will work in V5.7.5 and higher). How to get your existing palettes 1. Go to v0.9 GET / palettes and hit “RUN” How to create a new schema 1. Go to POST / palettes and insert the required schema into the “Value” input box and hit “RUN”. 2. Use the following syntax and update the “colors” and “name” parameters according to your needs. You can add up to 16 colors in a custom palette. In addition, you can modify the following parameters: 'isDefault' = true means that new dashboards will be created with this palette by default. There can only be one default palette at any time. 'sortOrder' - determines the order of the palette in the palettes list displayed in the dashboard drop-down { "colors": [ "#ff0000", "#001c5a", "#cfeb00", "#2dff00", "#00a79b", "#218A8C" ], "name": "MyPalette", "isDefault": true, "sortOrder": 10 } 3. The new palette will be added to your Dashboard Palettes. How to delete a palette: 1. Go to Delete / palettes / {name} and insert the required schema into the “Value” input box 2. Insert the name of the Palette you wish to delete into the Value input box and hit “RUN” 3. The Palette will be deleted from the Dashboard Palettes2.8KViews4likes0CommentsData Dictionary Rest API V2.0
Using the API we can retrieve the descriptions the users write in the elasticube for tables and columns. Edit the following: 1. Type username, password, server 2. Update the oid with the desired model you would like to run the script against. Script can be provided if descriptions from all models is needed. 3. Define the output. Current script writes to a csv but this can be easily updated to insert data into a db. Full python script below: https://codeshare.io/GbMdjb680Views0likes0CommentsModifying Sign-in Cookie Expiration in REST API
It is possible to modify the cookie expiration period and by that to determine how for how long the user will remained logged in when checking the "Remember Me". When a user logs in to Sisense and does not check the “Remember Me” check-box a session cookie is created leaving the user logged in, it will be automatically deleted when closing the browser. When checking the “Remember me”, a cookie called prism will be created. This cookie expires after 30 days by default but this parameter can be easily modified using the REST API under “settings\security”. Posting the following syntax will determine the number of days until the cookie expires. The following syntax will set the cookie expiration to one day: { "cookieExp": 1 } Please note that the parameter has to be an integer. Posting a decimal value (i.e. 0.5) will cause a “Redirect Loop” error which can be solved by deleting the configuration from the MongoDB with a MongoDB GUI tool. Restarting the IIS will be required.824Views0likes0Comments