Thato Posted February 14, 2019 Share Posted February 14, 2019 Hi AllI want to set a diffrent theme as active theme using Japer REST v2 api.I'm able to get my theme/resource using this endpoint http://<host>:<port>/jasperserver[-pro]/rest_v2/resources/themes/my_themeWhat I want is to change active default theme to my theme.Thank you Link to comment Share on other sites More sharing options...
joseng62 Posted February 14, 2019 Share Posted February 14, 2019 Hi ThatoYou utilizing Community Edition or Pro as the rest request stucture changes. So the manual gives example, but is focused on Jasper Pro and assuming you have already created an org called "Audit"The example is PUT http://localhost:8080/jasperserver-pro/rest_v2/organizations/AuditPayload will have content type : application/jsonWith json payload being :{"theme":"jasper_dark"}But i'll look into and test out how to do this in CE. As "organizations" do not work the same in CE.;-) Link to comment Share on other sites More sharing options...
joseng62 Posted February 14, 2019 Share Posted February 14, 2019 Ok here we go.The REST api call mentioned in documentation is for pro only. So this could be a work around. Do a GET request with jasper url and add flow.html?_flowId=searchFlow to the url. Example http://localhost:8081/jasperserver/flow.html?_flowId=searchFlowThen in the Body you receive back, you need to look for __jrsConfigs__.flowExecutionKey = YOU_NEEd_THIS_VALUE; in the body.Note the value flowExecution key will change from time to time, depending on how long the time lapse it between requests, change in users etc.Next you need to do a POST request. Here is example of POST message : url: http://localhost:8081/jasperserver/flow.html?_flowExecutionKey=THE_ABOVE_Key_Value &_eventId=setActiveTheme Headers: X-REMOTE-DOMAIN : 1Content-Type : application/x-www-form-urlencoded BODY: (Form)folderUri=/themes/jasper_dark ⌂⌂⌂⌂I tested the above REST call multiple time, I just updated the folderUri and the execution Key from time to time. All worked and I received a 200 response. Side note for manual testing, another way to get hold of the execution key is via the developer console. After signing into Jasper. Use Console tab and run: __jrsConfigs__.flowExecutionKeythis should return the code for you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now