Please see the following documentation for using our API.
Authentication & SSLIn order to send data you will need an Authentication token - please request these by emailing us at Keri@studentcard.co.nz or by calling us on 0800 664 409
Our test environment doesn’t use SSL, our live environment uses SSL.
JSON Call detailsWe currently have 6 endpoints
Adding Student Records
(Add & Update)
Address: https://diapi.studentcard.co.nz/api/students
Group Channels use: https://diapi.studentcard.co.nz/api/group/students
| Field | Example | Notes |
| authenticationToken | 5785dbee-1b64-4149-9076-7440c6d96dd5 | Required |
| Channel_code | 015 | Required if using group channel - 3 digit alphanumeric |
| Institution_code | 015 | Required - 3 digit numeric |
| Campus_name | Auckland | |
| Status | 1, or Current |
Required
Types:
|
| FirstName | John Francis | Required |
| LastName | Smith | Required for blank use period "." |
| dateofBirth | 30/06/1990 | If entered must be dd/MM/yyyy format |
| StudentID | 200212345 | Required |
| NSN | 012-235-2525 | |
| Course_Name | TNCO127-14m | |
| Class_name | TNCO127-14m-AGKJN | |
| Course_start_date | dd/MM/yyyy | If entered must be dd/MM/yyyy format |
| Course_end_date | dd/MM/yyyy | If entered must be dd/MM/yyyy format |
| Address1 | 123 Dominion Road | |
| Address2 | Mt Eden | |
| Address3 | RD2 | |
| City | Auckland | |
| Postcode | 1010 | |
| Mobile | 021 664409 | |
| abc@abc.co.nz | ||
| Sex | Male | Male or Female or Diverse |
| photo_image | /9j/4AAQSkZJRgAB etc etc etc | jpeg or png image is base64 with the guff at the start removed. eg ( image.replace(/^data:image\/(png|jpg|jpeg);base64,/, "") ); ) |
Expected return:
C# Example Code
single student
try
{
var request = (HttpWebRequest)WebRequest.Create("https://diapi.studentcard.co.nz/api/students");
request.ContentType = "text/json";
request.Method = "POST";
request.Headers.Add("authenticationToken", "5785dbee-1b64-4149-9076-7440c6d96dd5");
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
string json = new JavaScriptSerializer().Serialize(new
{
channel_code = "015",
institution_code = "015",
campus_name = "Auckland",
firstname = "John Francis",
lastName = "Smith",
dateofbirth = "30/06/1990",
studentid = "200212345",
course_name = "TNCO127-14m",
class_name = "TNCO127-14m-AGKJN",
course_start_date = "01/01/2015",
course_end_date = "31/12/2015",
status = "Current",
address1 = "123 Dominion Road",
address2 = "Mt Eden",
address3 = "RD2",
city = "Auckland",
postcode = "1010",
mobile = "021 664409",
email = "abc@abc.co.nz",
sex = "Male",
nsn = "012-235-2525"
photo_image = "/9j/4AAQSkZJRgAB etc etc etc"
});
streamWriter.Write(json);
}
var response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
Label1.Text = result.ToString();
}
}
catch (Exception ex)
{
//error processing
}
multiple students
try
{
var request = (HttpWebRequest)WebRequest.Create("https://diapi.studentcard.co.nz/api/students");
request.ContentType = "text/json";
request.Method = "POST";
request.Headers.Add("authenticationToken", "5785dbee-1b64-4149-9076-7440c6d96dd5");
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
string json = "[" + new JavaScriptSerializer().Serialize(new
{
channel_code = "015",
institution_code = "015",
campus_name = "Auckland",
firstname = "John Francis",
lastName = "Smith",
dateofbirth = "30/06/1990",
studentid = "200212345",
course_name = "TNCO127-14m",
class_name = "TNCO127-14m-AGKJN",
course_start_date = "01/01/2015",
course_end_date = "31/12/2015",
status = "Current",
address1 = "123 Dominion Road",
address2 = "Mt Eden",
address3 = "RD2",
city = "Auckland",
postcode = "1010",
mobile = "021 664409",
email = "abc@abc.co.nz",
sex = "Male",
nsn = "012-235-2525"
}
);
json += "," + new JavaScriptSerializer().Serialize(new
{
channel_code = "019",
institution_code = "015",
campus_name = "Auckland",
firstname = "Jack",
lastName = "Smith",
dateofbirth = "30/06/1994",
studentid = "200212346",
course_name = "TNCO127-14m",
class_name = "TNCO127-14m-AGKJN",
course_start_date = "01/01/2015",
course_end_date = "31/12/2015",
status = "Current",
address1 = "126 Dominion Road",
address2 = "Mt Eden",
city = "Auckland",
postcode = "1010",
mobile = "021664488",
email = "abcd@abc.co.nz",
sex = "Male",
nsn = "012-235-2526"
}
);
json += "]";
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(json);
}
var response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
Label1.Text = result.ToString();
}
}
catch (Exception ex)
{
// error processing
}
Adding Student Records Method 2
(Add & Update)
This is an alternative to the main POST method and returns a list of additions/modifications made to the StudentCard database.
Address: https://diapi.studentcard.co.nz/api/students/studentsend
| Field | Example | Notes |
| authenticationToken | 5785dbee-1b64-4149-9076-7440c6d96dd5 | Required |
| Channel_code | 015 | Required if using group channel - 3 digit alphanumeric |
| Institution_code | 015 | Required - 3 digit numeric |
| Campus_name | Auckland | |
| Status | 1, or Current |
Required
Types:
|
| FirstName | John Francis | Required |
| LastName | Smith | Required for blank use period "." |
| dateofBirth | 30/06/1990 | If entered must be dd/MM/yyyy format |
| StudentID | 200212345 | Required |
| NSN | 012-235-2525 | |
| Course_Name | TNCO127-14m | |
| Class_name | TNCO127-14m-AGKJN | |
| Course_start_date | dd/MM/yyyy | If entered must be dd/MM/yyyy format |
| Course_end_date | dd/MM/yyyy | If entered must be dd/MM/yyyy format |
| Address1 | 123 Dominion Road | |
| Address2 | Mt Eden | |
| Address3 | RD2 | |
| City | Auckland | |
| Postcode | 1010 | |
| Mobile | 021 664409 | |
| abc@abc.co.nz | ||
| Sex | Male | Male or Female or Diverse |
| photo_image | /9j/4AAQSkZJRgAB etc etc etc | jpeg or png image is base64 with the guff at the start removed. eg ( image.replace(/^data:image\/(png|jpg|jpeg);base64,/, "") ); ) |
Expected return:
C# Example Code
single student
try
{
var request = (HttpWebRequest)WebRequest.Create("https://diapi.studentcard.co.nz/api/students/studentsend");
request.ContentType = "text/json";
request.Method = "POST";
request.Headers.Add("authenticationToken", "5785dbee-1b64-4149-9076-7440c6d96dd5");
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
string json = new JavaScriptSerializer().Serialize(new
{
channel_code = "015",
institution_code = "015",
campus_name = "Auckland",
firstname = "John Francis",
lastName = "Smith",
dateofbirth = "30/06/1990",
studentid = "200212345",
course_name = "TNCO127-14m",
class_name = "TNCO127-14m-AGKJN",
course_start_date = "01/01/2015",
course_end_date = "31/12/2015",
status = "Current",
address1 = "123 Dominion Road",
address2 = "Mt Eden",
address3 = "RD2",
city = "Auckland",
postcode = "1010",
mobile = "021 664409",
email = "abc@abc.co.nz",
sex = "Male",
nsn = "012-235-2525",
photo_image = "/9j/4AAQSkZJRgAB etc etc etc"
});
streamWriter.Write(json);
}
var response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
Label1.Text = result.ToString();
}
}
catch (Exception ex)
{
//error processing
}
Retrieving Photos
Address: GET https://diapi.studentcard.co.nz/api/students/photos
AuthenticationToken is a required header. One of the other 3 must also be supplied
| Header | Example | Notes |
| authenticationToken | 5785dbee-1b64-4149-9076-7440c6d96dd5 | Required |
| allPhotos | y | If entered must be y |
| studentID | 20020020 | |
| allSince | 22/11/2019 | If entered must have dd/MM/yyyy format |
Expected return:
C# Example Code
try
{
var request = (HttpWebRequest)WebRequest.Create("https://diapi.studentcard.co.nz/api/students/photos");
request.ContentType = "text/json";
request.Method = "GET";
request.Headers.Add("authenticationToken", "5785dbee-1b64-4149-9076-7440c6d96dd5");
request.Headers.Add("allSince", "13/02/2019");
var response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
}
catch (Exception ex)
{
// error processing
}
Retrieving Modified Students
Address: GET https://diapi.studentcard.co.nz/api/students/modified
AuthenticationToken is a required header.
| Header | Example | Notes |
| authenticationToken | 5785dbee-1b64-4149-9076-7440c6d96dd5 | Required |
Expected return:
C# Example Code
try
{
var request = (HttpWebRequest)WebRequest.Create("https://diapi.studentcard.co.nz/api/students/modified");
request.ContentType = "text/json";
request.Method = "GET";
request.Headers.Add("authenticationToken", "5785dbee-1b64-4149-9076-7440c6d96dd5");
var response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
}
catch (Exception ex)
{
// error processing
}
Retrieving a single Student
Address: GET https://diapi.studentcard.co.nz/api/students/query
AuthenticationToken is a required header. Student ID must also be supplied
| Header | Example | Notes |
| authenticationToken | 5785dbee-1b64-4149-9076-7440c6d96dd5 | Required |
| studentID | 20020020 |
Expected return:
C# Example Code
try
{
var request = (HttpWebRequest)WebRequest.Create("https://diapi.studentcard.co.nz/api/students/query");
request.ContentType = "text/json";
request.Method = "GET";
request.Headers.Add("authenticationToken", "5785dbee-1b64-4149-9076-7440c6d96dd5");
request.Headers.Add("studentID", "20020020");
var response = (HttpWebResponse)request.GetResponse();
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
}
catch (Exception ex)
{
// error processing
}
Any Queries don’t hesitate to call
Office 0800 66 44 09
Mobile 021 664 409
Thanks for integrating with us
Keri