WiseNET API - StudentPosition Endpoint

From Wisenet Resource Centre
Jump to: navigation, search


This page is a part of WiseNET API: Developer Resources.

The Wise.NET StudentPosition endpoint allows your applications to get information about StudentPositions, add new StudentPositions, update their details.

StudentPosition is a position Student occupies in the Workplace.

Contents

Related Endpoints

StudentPosition Properties

If using xml serialization please order the properties alphabetically.

In the field list below for string fields datatype, maxlength and dropdown reference is specified.


Omitting fields in PUT statements:

Standard behavior: the StudentAdmin database will keep existing value.

The following are mandatory for a PUT / POST request:

The following are optional for a PUT / POST request:

The following are only returned on a GET request:

List All StudentPositions

GET /studentpositions/

Returns the list of all StudentPositions.

Sample request:

 curl -X GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   https://tst-api.wisenet.co/studentpositions/

Sample response:

<?xml version="1.0"?>
<StudentPositionSet xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.mywisenet.com.au/v1/">
	<SetCount>1</SetCount>
	<StudentPositions>
		<StudentPosition>
			<EndDate>2011-06-22T00:00:00</EndDate>
			<Link>
				<Href>studentpositions/studentposition/5</Href>
				<Rel>self</Rel>
				<Title>5: Robin Campbell -- Channel Nine‎</Title>
			</Link>
			<Position>Singer</Position>
			<StartDate>2008-04-09T00:00:00</StartDate>
			<Student>
				<AtsiStatus/>
				<Citizenship/>
				<CountryOfBirth/>
				<Disabilities/>
				<DisabilityAccessed/>
				<DisabilityFlag/>
				<EmploymentStatus/>
				<Ethnicity1/>
				<Ethnicity2/>
				<Ethnicity3/>
				<FeeHelp>
					<CitizenResident/>
					<HighestEducationLevel/>
					<IndigenousStatus/>
					<ParentEducationLevel1/>
					<ParentEducationLevel2/>
				</FeeHelp>
				<FirstName>Robin</FirstName>
				<Gender/>
				<HighestSchoolLevelCompleted/>
				<IwiAffiliation1/>
				<IwiAffiliation2/>
				<IwiAffiliation3/>
				<LanguageSpokenAtHome/>
				<LastName>Campbell</LastName>
				<LastSchoolAttended/>
				<Link>
					<Href>students/student/2</Href>
					<Rel>self</Rel>
					<Title>: Robin Campbell</Title>
				</Link>
				<MainActivityPriorToStudy/>
				<NRICType/>
				<Nationality/>
				<PassportCountry/>
				<PermanentAddress/>
				<PostalAddress/>
				<PriorEducationFlag/>
				<PriorEducationalAchievements/>
				<ResidentialStatus/>
				<SGExtraNationality/>
				<SecondaryQualification/>
				<SpokenEnglishProficiency/>
				<StreetAddress/>
				<StudentId>2</StudentId>
				<SyncToSugar>false</SyncToSugar>
				<SyncToXero>false</SyncToXero>
				<TargetGroup/>
			</Student>
			<StudentPositionId>5</StudentPositionId>
			<Workplace>
				<ANSZIC/>
				<Classification/>
				<Code>Code</Code>
				<Description>Channel Nine‎</Description>
				<IndustrySize/>
				<Link>
					<Href>workplaces/workplace/1</Href>
					<Rel>self</Rel>
					<Title>1: Code -- Channel Nine‎</Title>
				</Link>
				<PostalAddress/>
				<StreetAddress/>
				<WorkplaceId>1</WorkplaceId>
			</Workplace>
		</StudentPosition>
	</StudentPositions>
</StudentPositionSet>

C# Code Sample

public static void GetSample()
{
    const string url = "https://tst-api.wisenet.co/studentpositions/";
 
    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "GET";
    request.UserAgent = "C# Sample ClientIn Wise.NET a client is a student, trainee or apprentice";
 
    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();
 
                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException ex)
    {
        Console.WriteLine("Error: {0}", ex.Message);
    }
}

List modified StudentPositions

GET /workplaces/

Set the If-Modified-Since header in the HTTP request. The date must be in UTC format.

Returns the list of StudentPositions created or modified since the specified date.

The StudentPositions endpoint will filter on the <LastUpdated> field on each workplace. This field is updated to the current UTC date whenever a StudentPosition is created or edited.

Sample request:

 curl -GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   -H "If-Modified-Since: Fri, 8 Jul 2011 1:43:31 GMT" \
   https://tst-api.wisenet.co/studentpositions/

Response format would be the same as for the List All StudentPositions command.

Note: We would recommend that all calls to list StudentPositions from the API use this If-Modified-Since header.

C# Code Sample

private static void GetIfModifiedSinceSample()
{
    const string url = "https://tst-api.wisenet.co/studentpositions/";
 
    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.IfModifiedSince = DateTime.Now.AddDays(-1);
    request.Method = "GET";
    request.UserAgent = "C# Sample ClientIn Wise.NET a client is a student, trainee or apprentice";
 
    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();
 
                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException wex)
    {
        Console.WriteLine("Error: {0}", wex.Message);
    }
}

Filtered search

List StudentPositions by page

GET /studentpositions/?skip={skip}&take={take}

Skips {skip} items in StudentPositions list, then returns {take} items.

Sample request:

 curl -X GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   https://tst-api.wisenet.co/studentpositions/?skip=100&take=20

Response format would be the same as for the List All StudentPositions command.

List StudentPositions by WorkplaceCode

GET /studentpositions/?workplaceCode={somecode}

Returns only items associated with workplace with code {somecode}.

Sample request:

 curl -X GET \
   -H "Accept: application/vnd.mywisenet.api.v1+xml" \
   https://tst-api.wisenet.co/studentpositions/?workplaceCode=Code

Response format would be the same as for the List All StudentPositions command.

Read StudentPosition

GET /studentpositions/studentposition/{id}

Returns extended information about the studentposition with the specified {id}.

Sample request:

curl -X GET \
  -H "Accept: application/vnd.mywisenet.api.v1+xml" \
  https://tst-api.wisenet.co/studentpositions/studentposition/5

Sample response 1:

<StudentPosition xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<EndDate>2011-06-22T00:00:00</EndDate>
	<Link>
		<Href>studentpositions/studentposition/5</Href>
		<Rel>self</Rel>
		<Title>5: Robin Campbell -- Channel Nine‎</Title>
	</Link>
	<Position>Singer</Position>
	<StartDate>2008-04-09T00:00:00</StartDate>
	<Student>
		<AtsiStatus/>
		<Citizenship/>
		<CountryOfBirth/>
		<Disabilities/>
		<DisabilityAccessed/>
		<DisabilityFlag/>
		<EmploymentStatus/>
		<Ethnicity1/>
		<Ethnicity2/>
		<Ethnicity3/>
		<FeeHelp>
			<CitizenResident/>
			<HighestEducationLevel/>
			<IndigenousStatus/>
			<ParentEducationLevel1/>
			<ParentEducationLevel2/>
		</FeeHelp>
		<FirstName>Robin</FirstName>
		<Gender/>
		<HighestSchoolLevelCompleted/>
		<IwiAffiliation1/>
		<IwiAffiliation2/>
		<IwiAffiliation3/>
		<LanguageSpokenAtHome/>
		<LastName>Campbell</LastName>
		<LastSchoolAttended/>
		<Link>
			<Href>students/student/2</Href>
			<Rel>self</Rel>
			<Title>: Robin Campbell</Title>
		</Link>
		<MainActivityPriorToStudy/>
		<NRICType/>
		<Nationality/>
		<PassportCountry/>
		<PermanentAddress/>
		<PostalAddress/>
		<PriorEducationFlag/>
		<PriorEducationalAchievements/>
		<ResidentialStatus/>
		<SGExtraNationality/>
		<SecondaryQualification/>
		<SpokenEnglishProficiency/>
		<StreetAddress/>
		<StudentId>2</StudentId>
		<SyncToSugar>false</SyncToSugar>
		<SyncToXero>false</SyncToXero>
		<TargetGroup/>
	</Student>
	<StudentPositionId>5</StudentPositionId>
	<Workplace>
		<ANSZIC/>
		<Classification/>
		<Code>Code</Code>
		<Description>Channel Nine‎</Description>
		<IndustrySize/>
		<Link>
			<Href>workplaces/workplace/1</Href>
			<Rel>self</Rel>
			<Title>1: Code -- Channel Nine‎</Title>
		</Link>
		<PostalAddress/>
		<StreetAddress/>
		<WorkplaceId>1</WorkplaceId>
	</Workplace>
</StudentPosition>

Sample Response 2: incorrect ID would return 404 HTTP code

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
        The StudentPosition with ID '2' cannot be found.
    </string>

C# Code Sample

private static void ReadSample()
{
    const string url = "https://tst-api.wisenet.co/studentpositions/studentposition/1";
 
    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "GET";
    request.UserAgent = "C# Sample ClientIn Wise.NET a client is a student, trainee or apprentice";
 
    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();
 
                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException ex)
    {
        Console.WriteLine("Error: {0}", ex.Message);
    }
}

Update Student Position

PUT /studentpositions/studentposition/{id}

Updates the studentposition record with the specified {id}.

Notes: The GET message contains content that cannot just be sent back in the POST / PUT eg. <StudentPositionSet>.

POST / PUT can only be made individually per record and not in batch, so the request body would start with "<StudentPosition ", please see for example below.

If you like to receive the updated studentposition back please use reload=true parameter

PUT /studentpositions/studentposition/{id}?reload=true

Sample request:

 curl -X PUT \
   -H "Content-Type: application/vnd.mywisenet.api.v1+xml" \
   -v \
   -d @workplace1.xml \
   https://tst-api.wisenet.co/studentpositions/studentposition/5

workplace1.xml:

<StudentPosition xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<EndDate>2011-06-22T00:00:00</EndDate>
	<Position>Singer</Position>
	<StartDate>2008-04-09T00:00:00</StartDate>
	<Student>
		<StudentId>2</StudentId>
	</Student>
	<Workplace>
		<WorkplaceId>1</WorkplaceId>
	</Workplace>
</StudentPosition>

Sample response:

< HTTP/1.1 200 OK
< Date: Mon, 04 Jul 2011 23:34:04 GMT
< Content-Length: 0

C# Code Sample

private static void UpdateSample()
{
    const string url = "https://tst-api.wisenet.co/studentpositions/studentposition/5";
 
    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.ContentType = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "PUT";
    request.UserAgent = "C# Sample ClientIn Wise.NET a client is a student, trainee or apprentice";
 
    byte[] byteData = File.ReadAllBytes("studentposition1.xml");   
 
    // Set the content length in the request headers  
    request.ContentLength = byteData.Length;
 
    // Write data  
    using (Stream postStream = request.GetRequestStream())
    {
        postStream.Write(byteData, 0, byteData.Length);
    } 
 
    try
    {
        // Get response  
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream  
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();
 
                // Console application output  
                Console.WriteLine(responseBody);
            }
        }
    }
    catch (WebException wex)
    {
        Console.WriteLine("Error: {0}", wex.Message);
    }
}

PHP Code Sample

 function updateStudentposition_curl(){
 
    $credentials = "username:password"; 
    $URL = "https://tst-api.wisenet.co/studentpositions/studentposition/5"; //you can add ?reload=true if you wish to get updated studentpositioninfo
 
    $spUpdateById_XML = '<StudentPosition xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<EndDate>2011-06-22T00:00:00</EndDate>
	<Position>Singer</Position>
	<StartDate>2008-04-09T00:00:00</StartDate>
	<Student>
		<StudentId>2</StudentId>
	</Student>
	<Workplace>
		<WorkplaceId>1</WorkplaceId>
	</Workplace>
</StudentPosition>';
 
    /**
    * Create XML for updating the workplace information given in XML
    */
 
    /** use a max of 256KB of RAM before going to disk */  
    $putData = fopen('php://temp/maxmemory:256000', 'w+');  
    if (!$putData) {  
        die('could not open temp memory data');  
    }  
    fwrite($putData, $spUpdateById_XML );  
    fseek($putData, 0);  
 
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $URL);
    curl_setopt($ch, CURLOPT_PUT, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/vnd.mywisenet.api.v1+xml', 'User-Agent: PHP Sample client') );
    curl_setopt($ch, CURLOPT_INFILE, $putData);  
    curl_setopt($ch, CURLOPT_INFILESIZE, strlen($spUpdateById_XML )); 
 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_USERPWD, $credentials);
 
    $result = curl_exec($ch);
    $info = curl_getinfo($ch);
    fclose($putData);
    curl_close($ch);
    if($info['http_code']==204){
        return true;
    }else if($info['http_code']==200){
        return $result;
    }else{
        return false;
    }
 
}

Another PHP Code Sample

 function updateSP_curl(){
 
    $credentials = "username:password"; 
    $URL = "https://tst-api.wisenet.co/studentpositions/studentposition/1";//?reload=true
 
    $studentpositionUpdateById_XML = '<StudentPosition xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<EndDate>2011-06-22T00:00:00</EndDate>
	<Position>Singer</Position>
	<StartDate>2008-04-09T00:00:00</StartDate>
	<Student>
		<StudentId>2</StudentId>
	</Student>
	<Workplace>
		<WorkplaceId>1</WorkplaceId>
	</Workplace>
</StudentPosition>';
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $URL);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/vnd.mywisenet.api.v1+xml', 'User-Agent: PHP Sample client' ,'Content-Length: ' . strlen($workplaceUpdateById_XML)));
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); 
    curl_setopt($ch, CURLOPT_POSTFIELDS,$studentpositionUpdateById_XML);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_USERPWD, $credentials);
 
    $result = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);
    if($info['http_code']==204){
        return true;
    }else if($info['http_code']==200){
        return $result;
    }else{
        return false;
    }
 
}

Add StudentPosition

POST /studentpositions/

Inserts a new studentposition record.

Notes: The GET message contains content that cannot just be sent back in the POST / PUT eg. <StudentPositionSet>.

POST / PUT can only be made individually per record and not in batch, so the request body would start with "<StudentPosition ", please see for example below.

Restriction: StudentpositionId must be empty.

The Location header on the HTTP response will indicate the URI of the newly created StudentPosition resource.

If you like to receive newly created studentposition back please use reload=true param

POST /studentpositions/?reload=true

Sample request:

curl -X POST \
  -H "Content-Type: application/vnd.mywisenet.api.v1+xml" \
  -d @NewStudentposition.xml \
  -v \
  https://tst-api.wisenet.co/studentpositions/

NewStudentposition.xml:

<StudentPosition xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<EndDate>2011-06-22T00:00:00</EndDate>
	<Position>Singer</Position>
	<StartDate>2008-04-09T00:00:00</StartDate>
	<Student>
		<StudentId>2</StudentId>
	</Student>
	<Workplace>
		<WorkplaceId>1</WorkplaceId>
	</Workplace>
</StudentPosition>

Sample response:

< HTTP/1.1 200 OK
< Date: Mon, 04 Jul 2011 23:34:04 GMT
< Content-Length: 0
< Location: https://tst-api.wisenet.co/studentpositions/studentposition/2

C# Code Sample

private static void AddSample()
{
    const string url = "https://tst-api.wisenet.co/studentpositions/";
 
    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.ContentType = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "POST";
    request.UserAgent = "C# Sample ClientIn Wise.NET a client is a student, trainee or apprentice";
 
    byte[] byteData = File.ReadAllBytes("NewStudentposition.xml");
 
    // Set the content length in the request headers  
    request.ContentLength = byteData.Length;
 
    // Write data  
    using (Stream postStream = request.GetRequestStream())
    {
        postStream.Write(byteData, 0, byteData.Length);
    }
 
    try
    {
        // Get response
        using (var response = request.GetResponse() as HttpWebResponse)
        {
            // Get the response stream
            using (var responseReader = new StreamReader(response.GetResponseStream()))
            {
                string responseBody = responseReader.ReadToEnd();
 
                // Console application output
                Console.WriteLine("StatusCode: {0}; Response body: {1}", response.StatusCode, responseBody);
            }
        }
    }
    catch (WebException ex)
    {
        Console.WriteLine("Error: {0}", ex.Message);
    }
}

Sample request to post a JSON:

curl -X POST \
  -H "Content-Type: application/json" \
  -d @NewStudentposition.json \
  -v \
  https://tst-api.wisenet.co/studentpositions/

NewStudentposition.json:

{
	"EndDate":"\/Date(1308664800000+1000)\/",
	"Position":"Singer",
	"StartDate":"\/Date(1207663200000+1000)\/",
	"Student":{"StudentId":2},
	"Workplace":{"WorkplaceId":1}
}
Personal tools
Namespaces
Variants
Actions
Navigation
Translate
Wisenet Getting Started
Learning Relationship Management
Learner App
Trainer Portal
Wise.NET Portal
CRM
eLearning
Surveys
Finance
Application Integration
Compliance: Australia
Compliance: New Zealand
Developer Resources
Toolbox