loading Loading...
add chat to your website

How do I use ProProfs API to capture learners' data for my database/website?

Using our API, you can capture quiz data on your website or web-server with ease.


Example Use Cases of Capture API

  • Inserting lead capture into your own database such as name, email, etc. of quiz taker
  • Inserting names and information for people that take the test into SugarCRM, SalesForce, or any other CRM system
  • Triggering emails or any other process on your website when someone takes the test


How it Works

This feature requires minor programming effort at your side to accept the data sent by ProProfs. 


To get started, you would need to make a file (your callback script) which will accept the data sent by the quiz through REQUEST method. Whenever someone takes your quiz, your callback script will be called, which will accept the data. After accepting the data, you can write any custom code such as inserting into your database or CRM or triggering some business logic process.


This is a two-part process, where the first part is to set up the call back script URL and the second step is done on your website where you will code this script file to accept the REQUEST data.  


Please follow the below step to setup callback URL. 


Go to "Settings" page and click on "Notification" and select the checkbox under the label "Notification via API". Type the call back URL indicating where the script is on your site. This is the URL of the script which will accept the data in REQUEST method. Save your settings once done.



There are 15 total attributes which we support and pass them to REQUEST when someone takes your quiz. This is similar to REST or SOAP API's. 


You would use the REQUEST array method to capture the quiz attempt information. ProProfs Quiz Maker will call your callback URL and will post all of these variables to that particular script. Please see all the 15 quiz attributes(variables) below:


# Variable Name Variable Description Data Type Example (PHP)
1 result_id A unique ID to identify attempt INT $_REQUEST['result_id']
2 status

New: Refers to a new attempt.

Update: Refers to a score update on an existing attempt such as an instructor grading essay or assigning bonus points to update a student's score. Update existing score with the help of result_id in such a case.

VARCHAR $_REQUEST['status_id']
3 quiz_id A unique ID which will identify your quiz. INT $_REQUEST['quiz_id']
4 quiz_title A unique quiz title to identify your quiz. VARCHAR $_REQUEST['quiz_title']
5 quiz_name Name of your quiz. VARCHAR $_REQUEST['quiz_name']
6 attempt_date The date and time stamp of the attempt (UNIX TIMESTAMP) TIMESTAMP $_REQUEST['attempt_date']
7 total_marks Total number of marks you set for the quiz. Eg: 100. INT $_REQUEST['total_marks']
8 user_obtained_marks Total number of marks obtained by the quiz taker. INT $_REQUEST['user_obtained_marks']
9 user_percent_marks Percentage marks of quiz taker. INT $_REQUEST['user_percent_marks']
10 user_totalcorrect_answers Total number of correct answers by quiz taker. INT $_REQUEST['user_totalcorrect_answers']
11 user_totalwrong_answers Total number of wrong answers/anwer by the quiz taker. INT $_REQUEST['user_totalwrong_answer']
12 user_Id Quiz taker's ID VARCHAR $_REQUEST['user_Id']
13 user_Email Quiz taker's email address. VARCHAR $_REQUEST['user_Email']
14 user_Address Quiz taker's address VARCHAR $_REQUEST['user_Address']
15 user_City Quiz taker's city VARCHAR $_REQUEST['user_City']
16 user_State Quiz taker's state VARCHAR $_REQUEST['user_State']
17 user_Zipcode Quiz taker's zipcode VARCHAR $_REQUEST['user_Zipcode']
18 user_Phone Quiz taker's phone number VARCHAR $_REQUEST['user_Phone']
19 user_name Quiz taker's name VARCHAR $_REQUEST['user_name']
20 min_pass_marks Minimum passing marks INT $_REQUEST['min_pass_marks']


An Example: PHP & MySQL
If you are using PHP as server scripting. You can use the following example to test this feature.



Step 1: SQL: Create a table with the following SQL query:



CREATE TABLE `quiz_takers` (
  `test_id` int(11) NOT NULL auto_increment,
  `result_id` int(100) NOT NULL,
  `quiz_id` int(100) NOT NULL,
  `quiz_title` varchar(150) NOT NULL,
  `quiz_name` varchar(150) NOT NULL,
  `attempt_date` timestamp NOT NULL,
  `username` varchar(100) NOT NULL,
  `totalscore` int(100) NOT NULL,
  `obtainedmarks` int(100) NOT NULL,
  `userpercentscore` float NOT NULL,
  `totalcorrectanswer` int(50) NOT NULL,
  `totalwronganswer` int(50) NOT NULL,
  `userId` varchar(100) NOT NULL,
  `userEmail` varchar(100) NOT NULL,
  `userAddress` varchar(150) NOT NULL,
  `userCity` varchar(150) NOT NULL,
  `userState` varchar(150) NOT NULL,
  `userZipcode` int(100) NOT NULL,
  `userPhone` int(100) NOT NULL,
  `min_pass_marks` int(100) NULL,
  PRIMARY KEY  (`test_id`)


Step 2: PHP: Click here to download the PHP script (get_quiz_takers.php) file and upload it on to your web server.


Troubleshooting Guide:

If you are having trouble making the API work, try the following troubleshooting steps:

  1. ProProfs originates all requests from public facing IP ''. Ensure that this IP is not blocked. 
  2. After unblocking the IP, check if you are receiving requests from our server. You can execute the snippet titled 'responsetest.php' on your server. Change the email address in this script to your email id. Then update the callback URL of the quiz under "Edit Settings" -> "Notifications" to call this URL. Check if you receive an email after you complete the quiz. This validates if responses from ProProfs are reaching your server.


Click here to download the PHP script (responsetest.php)


Feel free to contact us, if you need further assistance with this feature.