How to Use REST API to Add and Track Users in a Classroom

 

ProProfs Training Maker allows you to use REST API to register, authenticate, and track learners for your courses and quizzes. This API application enables the utilization of three distinct processes:


1. Register New Users in a Classroom

2. Track User Progress For Each Assignment
3. Classroom User Authentication

 

Register New Users In a Classroom

Add new users to your classroom using their Email or ID with the help of this API method.

 

 NEW VERSION

 

Endpoint URL

POST- https://api.proprofs.com/classroom/v3/create/register

 

Note: Endpoint URL is Case-sensitive and without forward-slash ( / ) at the end.

 

Request Method

POST

 

Request Format

JSON

 

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. The date format should be mm/dd/yyyy
assignments No Object

URL encoded link of the assignment.

 

Sample quiz assignment link:

https://www.proprofs.com/quiz-school/ugc/story.php?title=customer-service-training-quiz-template-3334wt

 

URL encoded version:

https%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fugc%2Fstory.php%3Ftitle%3Dcustomer-service-training-quiz-template-3334wt

 

Sample course assignment link: https://www.proprofs.com/training/course/?title=business-training

 

URL encoded version:

https%3A%2F%2Fwww.proprofs.com%2Ftraining%2Fcourse%2F%3Ftitle%3Dbusiness-training

 

Sample Learning Path Private Code:

162XX9XX

group No Object You can include up to 5 groups while registering the user. 

 

Sample Code | JSON

 

Accept: application/json
Content-Type: application/json

{

"token":"*****7edf67d0a*****aca630b0*****",
"username":"YourProProfsUserName",
"email":"john@proprofs.com",
"id":"johndlabs100",
"password":"YourPassword",
"fname":"John",
"lname":"Smith",
"phone":"1111111111",
"address":"32E, John Corps, Main ST",
"city":"Phoenix",
"State":"Arizona",
"country":"USA",
"zip":"85705",
"expire":"12/31/2025",
"status":"active",
"assignments":{

"assignment1":"https%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fugc%2Fstory.php%3Ftitle%3Dcustomer-service-training-quiz-template-3334wt",
"assignment2":"http%3A%2F%2Fwww.proprofs.com%2Ftraining%2Fcourse%2F%3Ftitle%3Dethics-training-in-the-workplace_41",

"assignment3":"162XX9XX"

},
"group":{
"group1":{
"group_name":"gr-dlabs001",
"group_status":"active",
"assignments":{

"assignment1":"https%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fugc%2Fstory.php%3Ftitle%3Dcustomer-service-training-quiz-template-3334wt",
"assignment2":"http%3A%2F%2Fwww.proprofs.com%2Ftraining%2Fcourse%2F%3Ftitle%3Dethics-training-in-the-workplace_41",

"assignment3":"162XX9XX"
},
"is_group_admin":1,
"can_add_new_user":1,
"can_assign_user_to_group":1,
"can_assign_assignments":1,
"can_grade_reports":1,
"can_remove_user_from_group":1,
"can_delete_user":1,
"is_part_of":1,
"subgroup":{
"subgroup1":{
"subgroup_name":"subgr-dlabs001",
"subgroup_status":"active",
"assignments":{

"assignment1":"https%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fugc%2Fstory.php%3Ftitle%3Dcustomer-service-training-quiz-template-3334wt",
"assignment2":"http%3A%2F%2Fwww.proprofs.com%2Ftraining%2Fcourse%2F%3Ftitle%3Dethics-training-in-the-workplace_41",

"assignment3":"162XX9XX"

},
"is_group_admin":1,
"can_add_new_user":1,
"can_assign_user_to_group":1,
"can_assign_assignments":1,
"can_grade_reports":1,
"can_remove_user_from_group":1,
"can_delete_user":1,
"is_part_of":1
},
"subgroup2":{
"subgroup_name":"subgr-dlabs002",
"subgroup_status":"inactive",
"assignments":{

"assignment1":"https%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fugc%2Fstory.php%3Ftitle%3Dcustomer-service-training-quiz-template-3334wt",
"assignment2":"http%3A%2F%2Fwww.proprofs.com%2Ftraining%2Fcourse%2F%3Ftitle%3Dethics-training-in-the-workplace_41",

"assignment3":"162XX9XX"
},
"is_group_admin":1,
"can_add_new_user":1,
"can_assign_user_to_group":1,
"can_assign_assignments":1,
"can_grade_reports":0,
"can_remove_user_from_group":1,
"can_delete_user":0,
"is_part_of":1
}
}
},
"group2":{
"group_name":"gr-dlabs002",
"group_status":"inactive",
"assignments":{

"assignment1":"https%3A%2F%2Fwww.proprofs.com%2Fquiz-school%2Fugc%2Fstory.php%3Ftitle%3Dcustomer-service-training-quiz-template-3334wt",
"assignment2":"http%3A%2F%2Fwww.proprofs.com%2Ftraining%2Fcourse%2F%3Ftitle%3Dethics-training-in-the-workplace_41",

"assignment3":"162XX9XX"
},
"is_group_admin":0,
"can_add_new_user":0,
"can_assign_user_to_group":0,
"can_assign_assignments":0,
"can_grade_reports":0,
"can_remove_user_from_group":0,
"can_delete_user":0,
"is_part_of":0
}
}
}

 

The request JSON object contains information about the user, group, subgroup, and the courses that are to be assigned. Since a JSON string is significant, we should divide it into different chunks for better understanding.

 

Request Parameters for user information

 

Request Parameter

 

Request Parameters for the group information

 

Request Parameter for Group Information

 

 

Name Required Type Description
group_name No String The name of the group. The user will get assigned to the group if the group already exists. Otherwise, a new group will be created, and the user will assign it.
group_status No (default: active) Boolean The value should be active or inactive. The group with inactive status will not allow classroom access to their members (users).
assignments No Object

The list of quizzes and course links that you want to assign to the group. The link should be URL encoded, and the total number of assignments shouldn't exceed more than 50.

The assignment limit of 50 is applicable globally on the request. So, no matter whether we have consumed all 50 assignments to a group or divided them among multiple groups/subgroups/users. 

is_group_admin No (default: 0) Boolean The value should be 0 or 1. Status 1 will make this user a group administrator for the group.
can_add_new_user No (default: 0) Boolean The value should be 0 or 1. If the status is set to 1, the user (group administrator) will have permission to add a new user from the web portal and assign that user to the group. 
can_assign_user_to_group No (default: 0) Boolean The value should be 0 or 1. If the status is set to 1, the user (group administrator) can see the list of users available in the classroom and assign them to the group.
can_assign_assignments No (default: 0) Boolean The value should be 0 or 1. With status 1, the user (group administrator) can add assignments to the group.
can_grade_reports No (default: 0) Boolean The value should be 0 or 1. With status 1, the user (group administrator) can grade reports.
can_remove_user_from_group No (default: 0) Boolean The value should be 0 or 1. If the status is set to 1, the user (group administrator) can remove members from the group. 
can_delete_user No (default: 0) Boolean

The value should be 0 or 1. The user (group administrator) with status 1 will have permission to delete the user from the classroom.

Note: Delete is permanent, and you'll not be able to get it back once deleted.

is_part_of No (default: 0) Boolean The value should be 0 or 1. Status 1 will make this user a member of the group. 
subgroup No (default: 0) Object You can include up to 25 subgroups while registering the user. The subgroup limit of 25 is applicable globally on the request. So, no matter whether you have consumed all subgroups within a group or divided among the multiple groups. 

 

Request Parameters for the subgroup information

 

Request Parameter for Subgroup Information

 

Name Required Type Description
subgroup_name No (default: 0) String The name of the subgroup. If the subgroup exists, the user will be assigned to the subgroup. Otherwise, a new subgroup will be created, and then the user will get assigned to it.
subgroup_status No (default: active) String The value should be active or inactive. The subgroup with inactive status will not allow classroom access to their members (users).
assignments No Object

The list of quizzes and course links that you want to assign to the subgroup. The link should be URL encoded, and the total number of assignments shouldn't exceed more than 50.

The assignment limit of 50 is applicable globally on the request. So, no matter whether we have consumed all 50 assignments to a group or divided them among multiple groups/subgroups/users.

is_group_admin No (default: 0) Boolean The value should be 0 or 1. Status 1 will make this user a group administrator for the subgroup.
can_add_new_user No (default: 0) Boolean The value should be 0 or 1. If the status is set to 1, the user (group administrator) will have permission to add a new user from the web portal and assign that user to the subgroup.
can_grade_reports No (default: 0) Boolean The value should be 0 or 1. With status 1, the user (group administrator) can grade reports.
can_remove_user_from_group No (default: 0) Boolean The value should be 0 or 1. If the status is set to 1, the user (group administrator) can remove members from the subgroup.
can_delete_user No (default: 0) Boolean

The value should be 0 or 1. The user (group administrator) with status 1 will have permission to delete the user from the classroom.

Note: Delete is permanent, and you'll not be able to get it back once deleted.

can_assign_user_to_group No (default: 0) Boolean The value should be 0 or 1. If the status is set to 1, the user (group administrator) can see the list of users available in the classroom and assign them to the subgroup.
can_assign_assignments No (default: 0) Boolean

The value should be 0 or 1. With status 1, the user (group administrator) can add assignments to the subgroup.

is_part_of No (default: 0) Boolean The value should be 0 or 1. Status 1 will make this user a member of the group. 

 

Response Format

JSON

 

Example Response [Success]

 

Content-Type: application/json

{

"status":"success",

"uid":"20114120",

"email":"john@proprofs.com",

"id":"johndlabs100",

"action":"created"

}

 

Response Fields Description
status success when the user added or updated successfully.
uid The unique reference ID of the user post-registration.
email

The user email who just added/updated.

id The user ID who just added/updated.
action created or updated based on the action performed.

 

Example Response [Failed]

 

Content-Type: application/json

{

"status":"error",

"description":"Maximum 5 groups are allowed"

}

 

Response Fields Description
status error when the operation failed.
description

The error text describes the error.

 

 OLD VERSION

 

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 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. The 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, 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 in the classroom? 0 = No (Default), 1 = Yes.
can_assign_user_to_group No String Does this user have permission to add a user to the group? 0 = No (Default), 1 = Yes.
can_unassign_user_from_group No String Does this user have permission to remove a user from the group? 1 = No (Default), 0 = Yes.
can_delete_user No String

Is this user allowed to delete their group members? 0 = No (Default), one = 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-quiz. 

 

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.

 

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 The request method must be POST.
ERR1002 The request is empty.
ERR1003 Request parameter shouldn't be more than one.
ERR1004 Something wrong with the JSON request.
ERR1005 The token is missing.
ERR1006 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 to be not supported. Use the "Supported Country Names" section to pick the correct country name.
ERR1055 A maximum of 5 groups are permitted.
ERR1056 ID seems duplicate. Please use a unique ID.
ERR1059

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

(2) The subgroup you have defined is already a 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 the 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 each user's progress 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. The 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 the 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 The total number of users that exist in the classroom. This value will help you decide the number of API calls required to check each user's progress in the classroom. A single API call can return a maximum of 100 user records.
email The Email of the individual user exists in the classroom.
id The ID of the individual user 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 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 the user.
percentCompleted Exact progress status of the course. In the case of a quiz, the most recent quiz score will return.
group Name of groups the 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 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 Request parameter shouldn't be more than one.
ERR1004 Something wrong with the JSON request.
ERR1005 The token is missing.
ERR1006 ProProfs username is missing.
ERR1007 Incorrect token or username. The input token is not associated with the username.
ERR1008 No record was found.
ERR1009 The start offset shouldn't be greater than the total no. of users in the classroom.
ERR1010 The assignment hasn't been assigned to anyone yet.

 

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 users in the classroom using this API. It supports two modes of authentication.

 

  • Authentication using Email/Username only.

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

 

  • Authentication using both Email and Password

If email, username, and password are present in API, we'll detect learners' availability in the 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 the Email, username, and group name of the user.

assignment

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

user_status

The 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. The input token is not associated with the username.

ERR2050

Either Email or ID is required

ERR2051

The 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 users in the 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);

    ?>

Was this helpful?
© 2005 - 2024 ProProfs
-
add chat to your website