Jump to content

How to create a custom scheduler page with REST call to reportcaster


Guest

Recommended Posts

I am trying to create a custom schedule page. The custom schedule page will just have an email address and when I click the submit button, it should use the webfocus report caster REST api and create a simple schedule. I created the page via appstudio . And on the button_onclick if the do the following I am able to execute a previously created caster schedule

 

var eventObject = event event : window.event;

var ctrl = eventObject.target eventObject.target : eventObject.srcElement;

// TODO: Add your event handler code here

var xhttp = new XMLHttpRequest();

xhttp.open("GET", "https://server/ibi_apps/rs/ibfs/WFC/Repository/folder/car_test.sch", true);

xhttp.send();

 

When I try to create the schedule with the code below, I get a 404 error and not sure what I am doing wrong.

 

if(typeof(bRuntime) != 'undefined') {

// TODO: Add your inline runtime code here

}

//Begin function window_onload

function window_onload() {

UpdateData();

// TODO: Add your event handler code here

//add onInitialUpdate() function to make changes before initial run of the reports

}

//End function window_onload

//Begin function button1_onclick

function button1_onclick(event) {

var eventObject = event event : window.event;

var ctrl = eventObject.target eventObject.target : eventObject.srcElement;

var request = new XMLHttpRequest();

// POST to httpbin which returns the POST data as JSON

request.open('POST', 'https://server/ibi_apps/rs/ibfs/WFC/Repository/folder/api_test.sch', /* async = */ false);

var formData = new FormData();

formData.append('AuthEnabled', 'False');

formData.append('AuthPassword', 'NA');

formData.append('DistributionName', 'Email');

formData.append('InlineTaskIndex', 'False');

formData.append('MailFrom', 'False');

formData.append('MailReply', 'False');

formData.append('MailServer', 'False');

formData.append('MailSubject', 'False');

formData.append('AttachmentFlag', 'False');

formData.append('AuthEnabled', 'False');

formData.append('SSLflag', 'False');

formData.append('TLSflag', 'False');

formData.append('ZipFileName', 'False');

formData.append('ZipFlag', 'False');

formData.append('DistFile', 'False');

formData.append('DistPath', 'False');

formData.append('SingleAddress', 'email@email.com');

formData.append('Type', 'SINGLE_ADDRESS');

formData.append('Password', 'False');

formData.append('ProcedureName', 'False');

formData.append('ServerName', 'False');

formData.append('UserName', 'False');

formData.append('IBIWF_SES_AUTH_TOKEN', 'auth_code');

request.send(formData);

console.log(request.response);

}

 

//End function button1_onclick

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...