Before you start using our API
Before you dive in, you should understand and be OK with the fact that API code is usually pretty complicated, and programmers usually need to get involved.
For that reason we aren't able to provide our usual support on any API questions or issues you might face. Please refer those questions to your programmer.
Add Student to a Course
API Call: /api/public/student/create/?api_key={paste your key}
Send the following variables using "POST" method:
• student_email
• first_name
• last_name (optional)
• phone (optional)
• course_id
• password (optional, it will be generated and passed back to you if you do not send)
Here's a PHP code-snippet to add a student to a specific course, retrieve their unique magic link, and then redirect your student right to their membership site home page with no login required.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
'student_email' => $email,
'course_id' => '57365', // Course ID is in the URL of your course edit page
'first_name' => $firstname,
'last_name' => '', // Optional
'phone' => '', // Optional
'password' => '' // Optional. Password will be generated & sent back to you if this is empty
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
// Everything after here is optional
// Check for errors
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}
// Handle any possible errors
if (isset($error_msg)) {
echo "Error: ".$error_msg."";
exit;
} else {
$output_array = json_decode($output, true);
$magic_link=$output_array['magic_link'];
header("location: ".$magic_link); // Optional; redirect student to the course membership site home page
}
Update Basic Student Info
This API call will allow you to update student first name, last name, phone and password.
NOTE: email address is not available to update because it's the main identifier for a student in our system and if changed incorrectly, can cause unintended consequences. If you need to make a change to a student's email address, we suggest adding a new student record.
API Call: /api/public/student/update/?api_key={paste your key}
Send the following variables using "PATCH" method:
• student_email
• first_name (optional)
• last_name (optional)
• phone (optional)
• password (optional)
Here's a PHP code-snippet to update student info.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
'student_email' => $email,
'first_name' => $firstname,
'last_name' => $lastname,
'password' => $phone
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
Remove Student from a Course
API Call: /api/public/student/course/remove/?api_key={paste your key}
Send the following variables using "POST" method:
• student_email
• course_id
Remove Student from ALL Courses
API Call: /api/public/student/course/remove/all/?api_key={paste your key}
Send the following variables using "POST" method:
• student_email
Get List of Tags for a Student
API Call: /api/public/student/tag/list/?api_key={paste your key}
Send the following variables using "GET" method:
• student_email
Here's a PHP code-snippet:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'GET' ); $data = array(
'student_email' => $email,
'tagname' => 'vip', // specify an existing tag in your XP account
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
Add Tag to Student
API Call: /api/public/student/tag/manager/?api_key={paste your key}
Send the following variables using "POST" method:
• student_email
• tagname (multiple tags possible, separated by commas)
Here's a PHP code-snippet:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
'student_email' => $email,
'tagname' => 'vip', // specify an existing tag in your XP account
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
Remove Tag from Student
API Call: /api/public/student/tag/manager/?api_key={paste your key}
Send the following variables using "DELETE" method:
• student_email
• tagname (multiple tags possible, separated by commas)
Here's a PHP code-snippet:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
$data = array(
'student_email' => $email,
'tagname' => 'vip', // specify an existing tag in your XP account
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
Update a Student Custom Field
This allows you to update one or more custom fields for a student.
API Call: /api/public/student/customfield/?api_key={paste your key}
Send the following variables using "POST" method:
• student (use email address)
• field (custom field's name)
• value (custom field's value)
Here's a PHP code-snippet:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$data = array(
'student' => '[email protected]', // specify a student using their email address
'field' => 'COACH_NAME', // specify the custom field name
'value' => 'Marcy Brown', // specify the custom field value
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
Add a Tag
This allows you to add a new tag into your Xperiencify account.
API Call: /api/public/coach/tag/?api_key={paste your key}
Send the following variables using "POST" method:
• tagname (multiple tags possible, separated by commas)
Here's a PHP code-snippet:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
'tagname' => 'vip', // specify an existing tag in your XP account
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
Remove a Tag
This allows you to remove a new tag from your Xperiencify account.
API Call: /api/public/coach/tag/?api_key={paste your key}
Send the following variables using "DELETE" method:
• tagname (multiple tags possible, separated by commas)
Here's a PHP code-snippet:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); $data = array(
'tagname' => 'vip', // specify an existing tag in your XP account
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
Get a list of all Courses
This allows you to get a list of all courses in your account.
API Call: /api/public/coach/courses/?api_key={paste your key}
Here's a PHP code-snippet:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$output = curl_exec($ch);