Dat_Nguyen-Tat_9196

AE 12.1 REST API - Simple Front End webpage which gather user inputs and execute AE Job

Discussion created by Dat_Nguyen-Tat_9196 on Feb 5, 2018
Follow my colleagues' discussions:
https://community.automic.com/discussion/11158/ae-12-1-test-automation-engine-rest-api-with-soap-ui-beginner-level
https://community.automic.com/discussion/10794/getting-started-with-the-rest-api-for-automic-v12-1

I have a task related to this topic and I want to share what I did, hopefully it will help someone.

How it look like:  
$row[VALUE2]/$row[VALUE3] show up because I change the code to an non-existed database.  
 
yhiy06vfugsn.png
My Target:
1/ Create a webpage that allowed user to input value/ choose value from a drop-down (populate data from a SQL database).
2/ Based on user input, when they click the "Transfer Information" button all the information will send to AE server and execute a specific job. 
3/ Show the result (JOB's runID or Error message) which returned from AE Server.

Requirement:
- Automation Engine v12.1 and above (Active JCP/JWP) 
- Database server: I'm using MSSQL 12
- Web hosting (PHP): In my case, I'm using XAMPP in Windows. So I need to install: 
+ ODBC MSSQL client
wug72djo0y16.png

+ Accessing SQL Server Databases with PHP:

++ https://github.com/Microsoft/msphpsql/releases
Copy to C:\xampp\php\ext
++ Config the PHP.ini file: 
extension=php_pdo_sqlsrv_72_ts.dll
extension=php_sqlsrv_72_ts.dll

phpinfo should look like this:
bu5vyfa5jvtg.png

The code:
I'm not a developer, so the code might look stupid and not clean =) 
Please download the attachment for that.

- index.php: 
+ AE Prompt-set variable:
TEXT1# 
NUMBER200#
NUMBER300#

+ Authorization: Basic ************=
I took this from Postman. To be honest, I still can't figure out how to send the NAME/DEPARTMENT with PASSWORD directly to AE server. Looking for some suggestion :) 
2lnqj2lpji56.jpg
- config.php: Connect to the database 

Attachments

Outcomes