Loading...

API Endpoint: Unit Enrolments

Unit Enrolment Properties

The following are mandatory for a PUT / POST request:

  • CourseEnrolmentId
  • Student
  • UnitOffer

The following are optional for a PUT / POST request:

  • Grades
    • NZQAResult (see dropdowns: NZQAResult (NZ))
    • Outcome (see dropdowns: Outcome)
    • Practical (maxlength:50)
    • Provider (maxlength:3)
    • Result (custom dropdown: available in References)
    • Theory (maxlength:50)
  • ExpiryDate (date)
  • MoodleAccessEnabled (bit)
  • PeriodEnrolled (start and end dates)
  • Points (int)
  • Stage (int)
  • SupHours (int)
  • UnitEnrolmentId (int)
  • UnSupHours (int)

The following are returned only on a GET request:

  • AssessorEmail
  • AssessorFirstName
  • AssessorLastName
  • LastUpdated
  • Link
  • TrainerEmail
  • TrainerFirstName
  • TrainerLastName

List All Unit Enrolments

GET /unitoffers/enrolments

Returns the list of all Unit Enrolments.

Sample request:

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

Sample response:

  <UnitEnrolmentSet xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Link>
      <Href>/unitoffers/enrolments</Href>
      <Rel>self</Rel>
      <Title>Enrolments</Title>
    </Link>
    <SetCount>1</SetCount>
    <UnitEnrolments>
      <UnitEnrolment>
        <CourseEnrolmentId>2</CourseEnrolmentId>
        <LastUpdated>2011-12-13T09:18:39.127</LastUpdated>
        <Link>
          <Href>unitoffers/enrolments/enrolment/2</Href>
          <Rel>self</Rel>
          <Title>Fitzwilliam Darcy: U2 - CERTIFICATE II IN RETAIL OPERATIONS</Title>
        </Link>
        <MoodleAccessEnabled>true</MoodleAccessEnabled>
        <Student>
          <EmailAddress>fitzwilliam@darcy.com.au</EmailAddress>
          <FirstName>Fitzwilliam</FirstName>
          <LastName>Darcy</LastName>
          <LastUpdated>2011-12-13T09:18:39.127</LastUpdated>
          <Link>
            <Href>students/student/1</Href>
            <Rel>self</Rel>
            <Title>STD0000001: Fitzwilliam Darcy</Title>
          </Link>
          <RefInternal>STD0000001</RefInternal>
          <StudentId>1</StudentId>
          <Username>fitzwilliam@darcy.com.au</Username>
        </Student>
        <UnitEnrolmentId>2</UnitEnrolmentId>
        <UnitOffer>
          <CourseId>0</CourseId>
          <CourseOfferId>2</CourseOfferId>
          <CourseOfferLink>
            <Href>courseoffers/courseoffer/2</Href>
            <Rel>course-offer</Rel>
            <Title>2 - 0</Title>
          </CourseOfferLink>
          <DeliveryMode/>
          <Link>
            <Href>unitoffers/unitoffer/2</Href>
            <Rel>self</Rel>
            <Title>UO1: U2 - CERTIFICATE II IN RETAIL OPERATIONS</Title>
          </Link>
          <Location>
            <Description i:nil="true"/>
          </Location>
          <Program/>
          <Unit>
            <Code>U2</Code>
            <Description>CERTIFICATE II IN RETAIL OPERATIONS</Description>
          </Unit>
          <UnitEnrolmentsLink>
            <Href>unitoffers/unitoffers/enrolments</Href>
            <Rel>enrolments</Rel>
            <Title>All Unit Enrolments</Title>
          </UnitEnrolmentsLink>
          <UnitOfferCode>UO1</UnitOfferCode>
          <UnitOfferId>2</UnitOfferId>
          <UnitOfferPeriod>
            <EndDate>2011-12-03T00:00:00</EndDate>
            <StartDate>2010-12-03T00:00:00</StartDate>
          </UnitOfferPeriod>
          <UnitWebDetails/>
          <UrlEnrol i:nil="true"/>
          <Venue/>
          <WebDetails/>
        </UnitOffer>
      </UnitEnrolment>
    </UnitEnrolments>
  </UnitEnrolmentSet>

C# Code Sample

public static void GetUnitEnrolmentsSample()
{
    const string url = "https://tst-api.wisenet.co/unitoffers/enrolments";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "GET";
    request.UserAgent = "C# Sample Client";

    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 Unit Enrolments Modified

GET /unitoffers/enrolments

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

Returns the list of unit enrolments created or modified since the specified date.

The Unit Enrolments endpoint will filter on the <LastAuditTimestamp> field of each enrolment. This field is set to the current UTC date whenever an enrolment is created or edited.

Sample request:

 curl -X 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/unitoffers/enrolments

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

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

C# Code Sample

private static void GetIfModifiedSinceSample()
{
    const string url = "https://tst-api.wisenet.co/UnitOffers/enrolments";

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

    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 Unit Enrolments page

GET /unitoffers/enrolments?skip={skip}&take={take}

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

You can combine this request with the additional If-Modified-Since header.

Sample request:

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

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

List Unit Enrolments with specified MoodleAccessEnabled page

ET /unitoffers/enrolments?MoodleAccessEnabled=true&skip={skip}&take={take}

or

GET /unitoffers/enrolments?MoodleAccessEnabled=false&skip={skip}&take={take}

Skips {skip} items in Unit Enrolments list, then returns {take} items with specified MoodleAccessEnabled.

You can combine this request with the additional If-Modified-Since header.

Sample request:

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

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

Add Unit Enrolment record

OST /UnitOffers/enrolments

Inserts a Unit Enrolment record into the database.

Operation copies respective UnitOffer properties into newly created UnitEnrolment, implementing the same behavior as StudentAdmin UI.

If these properties are provided in the post statement they are overriden by provided ones.

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

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

Restriction: Unit Enrolment ID must be empty.

The Location header in the HTTP response will indicate the URI of the newly created Unit Enrolment resource.

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

POST /UnitOffers/enrolments?reload=true

Sample request:

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

NewUnitEnrolment.xml:

  <UnitEnrolment xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <CourseEnrolmentId>2</CourseEnrolmentId>
    <MoodleAccessEnabled>true</MoodleAccessEnabled>
    <Student>
      <EmailAddress>fitzwilliam@darcy.com.au</EmailAddress>
      <FirstName>Fitzwilliam</FirstName>
      <LastName>Darcy</LastName>
      <RefInternal>STD0000001</RefInternal>
      <StudentId>1</StudentId>
      <Username>fitzwilliam@darcy.com.au</Username>
    </Student>
    <UnitOffer>
      <Unit>
        <Code>U2</Code>
        <Description>CERTIFICATE II IN RETAIL OPERATIONS</Description>
      </Unit>
      <UnitOfferCode>UO1</UnitOfferCode>
      <UnitOfferId>2</UnitOfferId>
    </UnitOffer>
  </UnitEnrolment>

Sample response:

< HTTP/1.1 200 OK
< Date: Mon, 04 Jul 2011 23:34:04 GMT
< Content-Length: 0
< Location: http://tst-api.wisenet.co/unitoffers/enrolments/enrolment/2

C# Code Sample

private static void AddSample()
{
    const string url = "https://tst-api.wisenet.co/unitoffers/enrolments/";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.ContentType = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "POST";
    request.UserAgent = "C# Sample Client";

    byte[] byteData = File.ReadAllBytes("NewUnitEnrolment.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);
    }
}

Read Unit Enrolment

GET /unitoffers/enrolments/enrolment/{id}

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

Sample request:

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

Sample response 1:

<UnitEnrolment xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <CourseEnrolmentId>88</CourseEnrolmentId>
  <Grades>
    <NZQAResult/>
    <Outcome>
      <Code>90</Code>
      <Description>Result not available</Description>
    </Outcome>
    <Practical>3</Practical>
    <Provider>5</Provider>
    <Result>
      <Code/>
      <Description>the best</Description>
    </Result>
    <Theory>4</Theory>
  </Grades>
  <LastUpdated>2013-10-11T10:38:18.107</LastUpdated>
  <Link>
    <Href>unitoffers/enrolments/enrolment/1</Href>
    <Rel>self</Rel>
    <Title>GLENN  WEBB: THHBFB01A - OPERATE A BAR</Title>
  </Link>
  <MoodleAccessEnabled>false</MoodleAccessEnabled>
  <PeriodEnrolled>
    <StartDate>2001-10-10T00:00:00</StartDate>
  </PeriodEnrolled>
  <Points>1</Points>
  <Stage>2</Stage>
  <Student>
    <FirstName>GLENN </FirstName>
    <LastName>WEBB</LastName>
    <LastUpdated>2013-10-11T10:38:18.107</LastUpdated>
    <Link>
      <Href>students/student/9473</Href>
      <Rel>self</Rel>
      <Title>OCH010000O: GLENN  WEBB</Title>
    </Link>
    <RefInternal>OCH010000O</RefInternal>
    <StudentId>9473</StudentId>
  </Student>
  <SupHours>30</SupHours>
  <UnSupHours>1</UnSupHours>
  <UnitEnrolmentId>1</UnitEnrolmentId>
  <UnitOffer>
    <CourseOfferId>50</CourseOfferId>
    <CourseOfferLink>
      <Href>courseoffers/courseoffer/50</Href>
      <Rel>course-offer</Rel>
      <Title>50 - 0</Title>
    </CourseOfferLink>
    <DeliveryMode/>
    <Link>
      <Href>unitoffers/unitoffer/1156</Href>
      <Rel>self</Rel>
      <Title>: THHBFB01A - OPERATE A BAR</Title>
    </Link>
    <Location>
      <Description i:nil="true"/>
    </Location>
    <Program/>
    <Unit>
      <Code>THHBFB01A</Code>
      <Description>OPERATE A BAR</Description>
    </Unit>
    <UnitEnrolmentsLink>
      <Href>unitoffers/unitoffers/enrolments</Href>
      <Rel>enrolments</Rel>
      <Title>All Unit Enrolments</Title>
    </UnitEnrolmentsLink>
    <UnitOfferId>1156</UnitOfferId>
    <UnitOfferPeriod>
      <EndDate>2007-10-14T00:00:00</EndDate>
      <StartDate>2007-10-07T00:00:00</StartDate>
    </UnitOfferPeriod>
    <UnitWebDetails/>
    <UrlEnrol i:nil="true"/>
    <Venue/>
    <WebDetails/>
  </UnitOffer>
</UnitEnrolment>

Sample Response 2: incorrect ID would return 404 HTTP code

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

C# Code Sample

private static void ReadSample()
{
    const string url = "https://tst-api.wisenet.co/unitoffers/enrolments/enrolment/1";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Accept = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "GET";
    request.UserAgent = "C# Sample Client";

    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 Unit Enrolment record

PUT /UnitOffers/enrolments/enrolment/id

Updates the Unit Enrolment record in the database with specified UnitEnromentId.

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

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

If you like to receive newly updated object back please use reload=true param

PUT /UnitOffers/enrolments/enrolment/id?reload=true

Sample request:

curl -X PUT \
  -H "Content-Type: application/vnd.mywisenet.api.v1+xml" \
  -d @UnitEnrolment.xml \
  -v \
  https://tst-api.wisenet.co/unitoffers/enrolments/enrolment/1

UnitEnrolment.xml:

  <UnitEnrolment xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <CourseEnrolmentId>2</CourseEnrolmentId>
    <Grades>
      <NZQAResult/>
      <Outcome>
        <Code>90</Code>
        <Description>Result not available</Description>
      </Outcome>
      <Practical>3</Practical>
      <Provider>5</Provider>
      <Result>
        <Code/>
        <Description>passed</Description>
      </Result>
      <Theory>4</Theory>
    </Grades>
    <MoodleAccessEnabled>true</MoodleAccessEnabled>
    <Points>1</Points>
    <Student>
      <EmailAddress>fitzwilliam@darcy.com.au</EmailAddress>
      <FirstName>Fitzwilliam</FirstName>
      <LastName>Darcy</LastName>
      <RefInternal>STD0000001</RefInternal>
      <StudentId>1</StudentId>
      <Username>fitzwilliam@darcy.com.au</Username>
    </Student>
    <UnitEnrolmentId>1</UnitEnrolmentId>
    <UnitOffer>
      <Unit>
        <Code>U2</Code>
        <Description>CERTIFICATE II IN RETAIL OPERATIONS</Description>
      </Unit>
      <UnitOfferCode>UO1</UnitOfferCode>
      <UnitOfferId>2</UnitOfferId>
    </UnitOffer>
  </UnitEnrolment>

Sample response:

< HTTP/1.1 200 OK
< Date: Mon, 04 Jul 2011 23:34:04 GMT
< Content-Length: 0
< Location: http://tst-api.wisenet.co/unitoffers/enrolments/enrolment/2

C# Code Sample

private static void UpdateSample()
{
    const string url = "https://tst-api.wisenet.co/unitoffers/enrolments/enrolment/1";

    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.ContentType = "application/vnd.mywisenet.api.v1+xml";
    request.Method = "PUT";
    request.UserAgent = "C# Sample Client";

    byte[] byteData = File.ReadAllBytes("UnitEnrolment.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);
    }
}

Minimum JSON to POST a UnitEnrolment

{
  "CourseEnrolmentId":88,
  "Student":{"StudentId":21},
  "UnitOffer":{"UnitOfferId":69}
}

Was this Resource helpful?