Personal tools

Log in

Changes

From All n One's bxp software Wixi

Jump to: navigation, search

AJAX - API

2,043 bytes added, 13:31, 20 October 2022
no edit summary
====fn_bxp_API_eCourseSearch( )====
This function is used to query BXP eCourses and store them eCourse books for a specified global variable for further processinglist of their pages. URLs to each page are returned in the result as opposed to the actual page content itself.
'''blAPI_DataX:''' Can only be used on pages that are built in BXP, such as forms or custom reports. Can be set to true or false. If set to true, the API will attempt to authenticate with the server using the login credentials of whoever is currently logged into the system. strAPI_Account and strAPI_Key should be left blank if this is set to true.
'''inteCourse_Ids''': ID IDs of the ecourse eCourse books you want to retrievepages from.Takes a string in the form of comma separated whole numbers. For example, "1,12,15" will return all pages from the eCourse Books with IDs 1, 12 and 15(provided the total number of pages does not exceed strCountLimit). 
'''strCountLimit: '''Limit to apply to the query, will cap the number of results brought back by the query to the number suppliedpages retrieved. Takes an integer value.For example, if we are retrieving pages from books 1,12 and 15 as in the example above, but we have a cap of 10, only the first 10 pages will be returned. This is for the overall query and not per book, meaning that if book 1 has 9 pages, book 12 has 1 and book 15 has 3, we will receive all pages from books 1 and 12, but none from 15. 
'''strVariableToPopulate:''' Variable in which the results of the update query will be stored, takes a variable name as a string. Variable must be global(defined outside of any functions in your script). If attempting to insert a new record, this will return the ID of the new record if the insert was successful, otherwise it will return 0 or a negative value.
'''strFunctionOnStart:''' Code that will execute when the AJAX insert/update is launched, can be left blank. 
'''strFunctionOnFail:''' Code that will execute when the AJAX insert/update fails, can be left blank.
 
 
Below is an example on how this function can be invoked.
 
<span style="color: #ff00ff;">strBookIds = </span><span style="color: #000000;"><span style="color: #ff00ff;">'1,12,15';</span>
</span>fn_bxp_API_eCourseSearch(true, '<span style="color: #ffcc00;">client_example</span>'<span style="color: #cc99ff;">, , , true</span>, <span style="color: #ff00ff;">strBookIds</span>,<span style="color: #99ccff;">500</span>,'<span style="color: #ff6600;">strApiRetrieveResult</span>','console.log("API Retrieve Start")','<span style="color: #339966;">fn_AfterRetrieveResults();</span>','<span style="color: #3366ff;">console.log("API Retrieve Fail")</span>');
 
In this example the API will attempt to query links to the pages from <span style="color: #ff00ff;">eCourse Books 1, 12 and 15 </span>from the <span style="color: #ffcc00;">client_example</span> system. <span style="color: #99ccff;">Up to 500 pages</span> will be retrieved. <span style="color: #cc99ff;">The function will attempt to use the users current session to authenticate, the ID and Key fields are left blank as a result</span>.
 
<span style="color: #ff99cc;"><span style="color: #000000;">The results of the query will be stored in the global variable</span> <span style="color: #ff6600;">strApiRetrieveResult,<span style="color: #000000;"> and the function <span style="color: #00ff00;"><span style="color: #339966;">fn_AfterRetrieveResults()</span> </span>will run after a successful query result is returned, <span style="color: #3366ff;">otherwise, "API Retrieve Fail" will be printed to the console</span>.</span></span></span>
343
edits