ProProfs Quiz Maker Rest API Guide

 

ProProfs lets you use the REST API to register, authenticate, and track learners for your courses and quizzes.

 

This API application facilitates three distinct processes:

 

1. Registering new users in a classroom

2. Tracking user progress for each assignment, and

3. Enabling classroom user authentication

 

Advantages of REST API:

 

  • Developers enjoy flexibility as REST can handle multiple call types.

  • It uses less bandwidth and provides fast execution.

  • It facilitates autonomous development across various parts of the project.

 

In this article, you’ll learn,

 

1. How to register new users in a classroom

2. How to track user progress for each assignment

3. Hot to enable classroom user authentication

 

Register New User In Classroom

 

Endpoint URL:


The endpoint URL given below is used to call the Rest API. POST will be used as the request method. JSON will be your request format.

 

POST-https://www.proprofs.com/api/classroom/v1/user/register/

 

Request Parameters

 

Name Required Type Description
token Yes String Your private API key for the FAQ. The API key is available at: Settings > In-App Help > API key
username Yes String ProProfs username
email Yes (Either Email or ID is required) String User’s unique Email
id Yes (Either Email or ID is required String User’s unique ID
fname No String First name of the user
lname No String Last name of the user
password No String Password for the user to log in under a classroom. If missing, an auto-generated password will be assigned.
phone No String Phone No. of user
address No String User’s address
city No String City
state No String State
country No String Country
zip No String Zip
status No String Status ("active" / "inactive" / "delete")
expire No String Date when the user's access will expire. Date format should be mm/dd/yyyy
group No String Name the group in which you want to register the user. A maximum number of 5 groups is permitted. If no group name is mentioned, the user will still be registered but won't belong to any group.
group_status No String Status ("active" / "inactive"). Default is "Active" if group_status is not specified.
sub_group No String If a subgroup is specified, the corresponding parent group must be there.
sub_group_status No String Status ("active" / "inactive"). Default is "Active" if sub_group_status is not specified.
is_group_admin No String

Is this user going to act as group admin? 

 

0 = No (Default), 1 = Yes.

can_add_new_user No String

Does this user have permission to add a new user to a classroom?

 

0 = No (Default), 1 = Yes.

can_assign_user_to_group No String

Does this user have permission to add a user to a group? 

 

0 = No (Default), 1 = Yes.

can_unassign_user_from_group No String

Does this user have permission to remove a user from a group?

 

1 = No (Default), 0 = Yes.

can_delete_user No String

Is this user allowed to delete their group members? 

 

0 = No (Default), 1 = Yes.

can_assign_assignments No String

Can this user assign quizzes and courses to both users and groups?  

 

0 = No (Default), 1 = Yes.

quiz_assignment No String

Assign quizzes directly to users or groups. A full URL encoded link of the quiz is required.

 

E.g. http%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fstory.php%3Ftitle%3Dhalloween-quizz. 

 

Note: If the group name is missing, the quiz will be directly assigned to the user.

course_assignment No String

Assign courses directly to users or groups. A full URL encoded link of the course is required.

 

E.g. http%3A%2F%2Fwww.proprofs.com%2Ftraining%2Fcourse%2F%3Ftitle%3Dfederal-sexual-harassment. 

 

Note: If the group name is missing, the course will be directly assigned to the user.

 

Sample Code | JSON

 

Accept: application/json
Content-Type: application/json
{  
    "token": "3f39bfe3d52efe4a975ce19eb1e9db4e",
    "username": "johnsmith",
    "email": "johnsmith@example.com",
    "id": 1024,
    "fname": "John",
                "lname": "Smith",
                "password": "rdsxc234edsx",
                "phone": "555-555-5555",
                "address": "100 MAIN ST",
                "city": "PHOENIX",
                "state": "AZ",
                "country": "USA",
                "zip": "85123",
                "status": "active",
                "expire": "06/30/2022",
                "group": ["sales","finance","marketing"],

                "group_status": ["active","active","inactive"],

                "sub_group": ["inbound","credit","digital"],

                "quiz_assignment: ["http%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fstory.php%3Ftitle%3Dhalloween-quizz", "http%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fstory.php%3Ftitle%3Dhalloween-quizz", "http%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fstory.php%3Ftitle%3Dhalloween-quizz"]
      }

 

Response Format

JSON

 

Example Response [Success]

 

Content-Type: application/json
{  
    "status": "SUCCESS",
    "email": "johnsmith@example.com",
    "id": "1024"
    }

 

Responses on Success

 

Response Fields Description
status Will return either “SUCCESS” or “ERROR”
email

Email of user

id ID of user

 

Example Response [Error]

 

Content-Type: application/json
 {
                "status": "ERROR",
                "code": "ERR1001",
                "error": "API key is invalid"
}

 

Responses on Error

 

Error Fields Description
status In case of an error, this field will always contain the string “ERROR”
code

Unique error code

error Descriptive error message

 

Error Codes and Descriptions

 

Error Code Description
ERR1001 The request method must be POST.
ERR1002

The request is empty.

ERR1003

The request parameter shouldn't be more than one.
ERR1004 Something is wrong with the JSON request.
ERR1005

The token is missing.

ERR1006 The ProProfs username is missing.
ERR1007

Incorrect token or username. The input token is not associated with the username.

ERR1050 Either Email or ID is required and it should be unique.
ERR1051

Email shouldn't be empty.

ERR1052 ID shouldn't be empty.
ERR1053

The email pattern is incorrect.

ERR1054 The country name seems not to be supported. Use the “Supported Country Names” section to pick the correct country name.
ERR1055

A maximum of 5 groups is permitted.

ERR1056 ID seems duplicate. Please use a unique ID.
ERR1059

(1) A parent group can't be added as a sub-group.

(2) The sub-group you have defined is already a parent of another group. 

 

Live Example in PHP

 

This example will help you register the user in the classroom using the ProProfs API.

 

  function sendRequest($json)  
    {  
        $curl_obj = curl_init();
        curl_setopt($curl_obj, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl_obj, CURLOPT_URL, "https://www.proprofs.com/api/classroom/v1/user/register/");
        curl_setopt($curl_obj, CURLOPT_POSTFIELDS, $json);  
        curl_setopt($curl_obj, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl_obj, CURLOPT_POST, 1);
        curl_setopt($curl_obj, CURLOPT_HEADER, 0);  
        return curl_exec($curl_obj);  
    }
   
      $request_array = array();
   
      $request_array["token"] = "Your API Key";
      $request_array["username"] = "Your ProProfs Username";
      $request_array["email"] = "john@proprofs.com";
      $request_array["id"] = "12345";
      $request_array["fname"] = "John";
      $request_array["lname"] = "Smith";
      $request_array["password"] = "john101";
      $request_array["phone"] = "555-555-5555";
      $request_array["address"] = "151 Street Suit";
      $request_array["city"] = "Santa Monica";
      $request_array["state"] = "CA";
      $request_array["country"] = "United States";
      $request_array["zip"] = "90401";
      $request_array["status"] = "active";

      $request_array["expire"] = "12/31/2015";

 

      // User will be member of three groups Marketing,  Sales and Support.
      $group_array = array("Marketing", "Sales", "Support");

      $request_array["group"] = $group_array;

      

       // User will be group admin for Sales and Support groups only.

      $group_admin_array = array("0", "1", "1");

      $request_array["is_group_admin"] =  $group_admin_array;

 

      // User can add new users under classroom only when acting as group admin for Sales and Support groups.

      $add_user_permission = array("0", "1", "1");

      $request_array["can_add_new_user"] = $add_user_permission;

 

      $json_request_string = json_encode( $request_array);
      echo sendRequest($json_request_string);

?>

 

Track User Progress For Each Assignment

 

Track the progress of each user against assignments with the help of this API method.

 

The Endpoint URL to call the REST API:

 

https://www.proprofs.com/api/classroom/v1/reports/users/

 

POST will be used as the request method, and JSON will be the request format.

 

Request Parameters

 

Name Required Type Description
token Yes String Unique ProProfs API key
username Yes String ProProfs username
start No Integer The starting index for the results. Default 1.
num No Integer The requested number of results. Default 100. The maximum limit is 100 per API call.
email_or_id No String This is used to filter records. If mentioned, the API will return records for the specified email or ID. 

group_name

No String This can be used to fetch the data of group members such as the status of pending and completed assignments.

 

Sample Code | JSON

 

Endpoint URL:

 

https://www.proprofs.com/api/classroom/v1/reports/users/
Accept: application/json
Content-Type: application/json
{  
    "token": "3f39cfe3d52efe4a275be19eb1e9db4e",
    "username": "johnsmith",
    "start": 1,
    "num": 100
}

 

Response Format

JSON

 

Example Response [Success]

 

Content-Type: application/json           
{
        "status":"SUCCESS",
        "userCount":1500,
        "result":[
        {
         "email":"john@example.net",
         "id":"RE101",
         "name":"JOHN SMITH",
         "group":[
            "Media",
            "Advertising",
            "Marketing"

         ],
         "assignment":[
          {
             "type":"course",
             "title":"Comparative Media Studies",
             "status":"Completed",
             "progress":"100",

             "assignedOnDate":"02/15/2021",

             "percentCompleted":"90"
          },
          {
             "type":"quiz",
             "title":"Unit quizzes on comparative media",
             "status":"Pending",
             "progress":"0",

             "assignedOnDate":"02/15/2021",

             "percentCompleted":"90"
          }
          ]
        }
      ]
    }

 

Responses on Sucess

 

Response Fields Description
status Will return either “SUCCESS” or “ERROR”
userCount The total number of users that exist in the classroom. This value will help you decide the number of API calls required to check the progress of each user in the classroom. A single API call can return a maximum of 100 user records.
email Email of individual users in the classroom.
id The ID of individual users that exists in the classroom.
name Name of the user in the classroom.
type Will either return “Quiz” or “Course”.
title Title of the quiz or course.
status Status of assigned quiz and course. It may be either “Pending” or “Completed”.
progress The progress level of the individual course or quiz. If it is pending, progress will return 0. Otherwise, actual completion progress in a course such as 65%, 50%, etc.
assignedOnDate The date on which quiz/course was assigned to a user.
percentCompleted Exact progress status of the course.  In the case of a quiz, the most recent quiz score will return.
group The name of groups a user is associated with.

 

Example Response [Error]

 

Content-Type: application/json

 {

                "status": "ERROR",

                "code": "ERR1001",

                "error": "API key is invalid"

             }

 

Responses on Error

 

Error Fields Description
status In case of an error, this field will always contain the string “ERROR”
code Unique error code
error Descriptive error message

 

Error Codes and Descriptions

 

Error Code Description
ERR1001 The request method must be POST.
ERR1002 The request is empty.
ERR1003 The request parameter shouldn't be more than one.
ERR1004 Something is wrong with the JSON request.
ERR1005 The token is missing.
ERR1006 The ProProfs username is missing.
ERR1007 Incorrect token or username. Input token is not associated with the username.
ERR1008 No record was found.
ERR1009 The starting offset shouldn’t be greater than the total number of users in the classroom.
ERR1010 The assignment hasn't been assigned to anyone yet. No result was found.

 

Supported Country Names

 

 

Classroom User Authentication

 

Authenticate users in the classroom using this API. It supports two modes of authentication.

 

1. Authentication using Email/Username

 

If the request contains only an email or a username, we’ll detect the learner’s availability in the classroom.

 

2. Authentication using both Email and Password

 

If email, username, and password are present in the API, we’ll detect learners’ availability in the classroom and authenticate it using their password.

 

The Endpoint URL to call the REST API:

 

https://www.proprofs.com/api/classroom/v1/user/auth/

 

POST will be used as the request method, and JSON will be the request format.

 

Request Parameters

 

Name Required Type Description

token

Yes

String

Unique ProProfs API key

username

Yes

String

ProProfs username

email_or_ID

Yes (Either Email or ID is required)

String

Learner’s unique Email or Username

password

Yes

String

MD5 encrypted password.

 

Sample Code | JSON

 

POST-https://www.proprofs.com/api/classroom/v1/user/auth/

Accept: application/json

Content-Type: application/json

{  

   "token": "3f39bfe3d52efe4a975ce19eb1e9db4e",

   "username": "johnsmith",

   "email_or_ID": "johnsmith@example.com",

   "password": "eb0efbc37b1b47d2d69be2240acfe63a"   

            }

 

Response Format

JSON

 

Example Response [Success]

 

Content-Type: application/json           

{

       "status":"SUCCESS",

       "result":[

         {

        "email":"john@example.net",

        "ID":"RE101",

        "name":"JOHN SMITH",

        "user_status":"active",

         "expiry_date":"05/22/2022",

        "group":[

           "Media",

           "Advertising",

           "Marketing"

        ],

        "assignment":[

         {

            "type":"course",

            "title":"Comparative Media Studies",

"unique_title":"comparative_media_studies",

            "progress":"Completed"

         },

         {

            "type":"quiz",

            "title":"Unit quizzes on comparative media",

"unique_title":"unit_quizzes_on_comparative_media",

            "progress":"Pending"

         }

          ]

       }

     ]

          }

 

Responses on Success

 

Response Fields Description

status

Will return either “SUCCESS” or “ERROR”

result

These contain the email, username, and group name of the user.

assignment

Courses and quizzes assigned to the user and status of the assignment

user_status

User's status can be “active”, “inactive” or “expired”.

expiry_date

Expiration date in mm/dd/yyyy format, if available.

 

Example Response [Error]

 

Content-Type: application/json

{

       "status": "ERROR",

       "code": "ERR2001",

       "error": "Request method must be POST"

            }

 

Responses on Error

 

 

Error Fields Description

status

In case of error, this field will always contain the string “ERROR”

code

Unique error code

error

Descriptive error message

 

Error Codes and Descriptions

 

Error Code Description

ERR2001

Request method must be POST

ERR2002

Request is empty

ERR2002

Request parameter shouldn't be more than one

ERR2004

Something wrong with the JSON request

ERR2005

Token is missing

ERR2006
 

ProProfs username is missing

ERR2007
 

Incorrect token or username. Input token is not associated with the username

ERR2050

Either Email or ID is required

ERR2051

Email pattern is incorrect

ERR2052

User not authorized

 

Live Example in PHP

 

This example will help you authenticate users in the classroom using the ProProfs REST API.

 

<?php

function sendRequest($json)

   {  

       $curl_obj = curl_init();

       curl_setopt($curl_obj, CURLOPT_SSL_VERIFYPEER, false);

       curl_setopt($curl_obj, CURLOPT_URL, "https://www.proprofs.com/api/classroom/v1/user/auth/");

       curl_setopt($curl_obj, CURLOPT_POSTFIELDS, $json);  

       curl_setopt($curl_obj, CURLOPT_RETURNTRANSFER, 1);

       curl_setopt($curl_obj, CURLOPT_POST, 1);

       curl_setopt($curl_obj, CURLOPT_HEADER, 0);  

       return curl_exec($curl_obj);  

   }

  

     $request_array = array();

 

     $request_array["token"] = "Your API Key";

     $request_array["username"] = "Your ProProfs Username";

     $request_array["email_or_ID"] = "john@proprofs.com";

     $request_array["password"] = "3aa801d5d85e77ce9f2e431d8bf5fd73";  

               $json_request_string = json_encode( $request_array);

   echo sendRequest($json_request_string);

    ?>

 

That is all about using the REST API in ProProfs Quiz Maker.

 

 

Was this information helpful?

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. Please make sure you spelled the page name correctly or use the search box.

add chat to your website