loading Loading...
add chat to your website

ProProfs REST API Guide

Register New User In Classroom

Add new user in classroom using their Email or ID with the help of this API method.

 

Endpoint URL
https://www.proprofs.com/api/classroom/v1/user/register/

 

Request Method
POST

 

Request Format
JSON

 

URL Parameters

Name Required Type Description
token Yes String Unique ProProfs 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 user
lname No String Last name of user
password No String Password for user to login under 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 are permitted. If no group name is mentioned, 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 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 new user in classroom? 0 = No (Default), 1 = Yes.
can_assign_user_to_group No String Does this user have permission to add user in group? 0 = No (Default), 1 = Yes.
can_unassign_user_from_group No String Does this user have permission to remove user from 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 user and groups?  0 = No (Default), 1 = Yes.
quiz_assignment No String

Assign quiz directly to user or groups. 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 group name is missing, quiz will be directly assigned to the user.

course_assignment No String

Assign course directly to user or groups. 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 group name is missing, course will be directly assigned to the user.

 

 

Example Request

POST https://www.proprofs.com/api/classroom/v1/user/register/
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": "12/31/2015",
                "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

 

Response on Success

Response Fields Description
status Will return either “SUCCESS” or “ERROR”
email Email of user
id ID of user

 

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

 

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 Request method must be POST.
ERR1002 Request is empty.
ERR1003 Request parameter shouldn't be more than one.
ERR1004 Something wrong with JSON request.
ERR1005 Token is missing.
ERR1006 ProProfs username is missing.
ERR1007 Incorrect token or username. Input token is not associated with 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 Email pattern is incorrect.
ERR1054 Country name seems to be not supported. Use “Supported Country Names” section to pick correct country name.
ERR1055 Maximum 5 groups are permitted.
ERR1056 ID seems duplicate. Please use unique ID.
ERR1059

(1) Parent group can't be added as subgroup.

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

 

Example Error Response

 

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


Live example in PHP
This example will help you register the user in classroom using 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 progress of each individual user against assignments with the help of this API method.

 

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

 

Request Method
POST

 

Request Format
JSON

 

URL 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. Maximum limit is 100 per API call.
email_or_id No String This is used to filter records. If mentioned, 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 status of pending and completed assignments.

 

Example Request
POST 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

 

Response on Success

Response Fields Description
status Will return either “SUCCESS” or “ERROR”
userCount Total number of users that exist in the classroom. This value will help you decide the number of API calls required to check progress of each user in classroom. A single API call can return maximum 100 user records.
email Email of individual user exists in classroom.
id ID of individual user that exists in the classroom.
name Name of the user in 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 Progress level of the individual course or quiz. If it is pending, progress will return 0. Otherwise actual completion progress in course such as 65%, 50% etc.
assignedOnDate Date on which quiz/course was assigned to user.
percentCompleted Exact progress status of the course.  In case of quiz, most recent quiz score will return.
group Name of groups user is associated with.

 

Example Response

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/2016",

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

             "assignedOnDate":"02/15/2016",

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


Responses on Error

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

 

Error Codes and Descriptions

Error Code Description
ERR1001 Request method must be POST.
ERR1002 Request is empty.
ERR1003 Request parameter shouldn't be more than one.
ERR1004 Something wrong with the JSON request.
ERR1005 Token is missing.
ERR1006 ProProfs username is missing.
ERR1007 Incorrect token or username. Input token is not associated with username.
ERR1008 No record found.
ERR1009 Start offset shouldn’t be greater than the total no. of users in the classroom.

 

Example Error Response

Content-Type: application/json

 {

                "status": "ERROR",

                "code": "ERR1001",

                "error": "API key is invalid"

             }

 
Supported Country Names

Afghanistan, Albania, Algeria, Andorra, Angola, Antigua & Deps, Argentina, Armenia, Australia, Austria, Azerbaijan, Bahamas, Bahrain, Bangladesh, Barbados, Belarus, Belgium, Belize, Benin, Bhutan, Bolivia, Bosnia Herzegovina, Botswana, Brazil","Brunei, Bulgaria, Burkina, Burundi, Cambodia, Cameroon, Canada, Cape Verdi, Central African Rep, Chad, Chile, China, Colombia, Comoros, Congo, Congo {Democratic Rep}, Costa Rica, Croatia, Cuba, Cyprus, Czech Republic, Denmark, Djibouti, Dominica, Dominican Republic, East Timor, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eritrea, Estonia, Ethiopia, Fiji, Finland, France, Gabon, Gambia, Georgia, German, Ghana, Greece, Grenada, Guatemala, Guinea, Guinea-Bissau, Guyana, Haiti, Honduras, Hungary, Iceland, India, Indonesia, Iran, Iraq, Ireland {Republic}, Israel, Italy, Ivory Coast, Jamaica, Japan, Jordan, Kazakhstan, Kenya, Kiribati, Korea North, Korea South, Kuwait, Kyrgyzstan, Laos, Latvia, Lebanon, Lesotho, Liberia, Libya, Liechtenstein, Lithuania, Luxembourg, Macedonia, Madagascar, Malawi, Malaysia, Maldives, Mali, Malta, Marshall Islands, Mauritania, Mauritius, Mexico, Micronesia, Moldova, Monaco, Mongolia, Montenegro, Morocco, Mozambique, Myanmar {Burma}, Namibia, Nauru, Nepal, Netherlands, New Zealand, Nicaragua, Niger, Nigeria, Norway, Oman, Pakistan, Palau, Panama, Papua New Guinea, Paraguay, Peru, Philippines, Poland, Portugal, Qatar, Romania, Russian Federation, Rwanda, St Kitts & Nevis, St Lucia, St Vincent & Gr/dines, Samoa, San Marino, Sao Tome & Principe, Saudi Arabia, Senegal, Serbia, Seychelles, Sierra Leone, Singapore, Slovakia, Slovenia, Solomon Islands, Somalia, South Africa, Spain, Sri Lanka, Sudan, Suriname, Swaziland, Sweden, Switzerland, Syria, Taiwan, Tajikistan ,Tanzania, Thailand, Togo, Tonga, Trinidad & Tobago, Tunisia, Turkey, Turkmenistan, Tuvalu, Uganda, Ukraine, United Arab Emirates, United Kingdom, United States, Uruguay, Uzbekistan, Vanuatu, Vatican City, Venezuela, Vietnam, Yemen, Zambia, Zimbabwe

 

Classroom User Authentication

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

 

  • Authentication using Email/Username only

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

 

  • Authentication using both Email and Password

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

 

Endpoint URL

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

 

Request Method

POST

 

Request Format

JSON

 

URL 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

No

String

MD5 encrypted password (optional).

 

 

Example Request

 

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": "rdsxc234edsx"   

            }

 

Response Format

JSON

 

Response on Success

 

Response Fields

Description

status

Will return either “SUCCESS” or “ERROR”

result

These contain email, username and group name of user.

assignment

Courses and quizzes assigned to 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

Content-Type: application/json           

{

       "status":"SUCCESS",

       "result":[

         {

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

        "ID":"RE101",

        "name":"JOHN SMITH",

        "user_status":"active",

         "expiry_date":"05/22/2015",

        "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 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

 

    Example Error Response

    Content-Type: application/json

{

       "status": "ERROR",

       "code": "ERR2001",

       "error": "Request method must be POST"

            }

 

Live example in PHP

This example will help you authenticate user in classroom using 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);

    ?>