WiseNET.API - Unit Offers Endpoint

From Wisenet Resource Centre
Jump to: navigation, search


The Wise.NET Unit Offers endpoint allows your applications to get information about unit offers and unit enrolments, and to submit new unit enrolments.

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

Contents

Related Endpoints

Unit Offer Properties

List All Unit Offers

GET /unitoffers/

Returns the list of all unit offers.

Sample request:

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

Sample response:

  <UnitOfferSet xmlns="http://api.mywisenet.com.au/v1/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <SetCount>1</SetCount>
    <UnitOffers>
      <UnitOffer>
        <CourseId>1</CourseId>
        <CourseOfferId>1</CourseOfferId>
        <CourseOfferLink>
          <Href>courseoffers/courseoffer/1</Href>
          <Rel>course-offer</Rel>
          <Title>1 - 1</Title>
        </CourseOfferLink>
        <DeliveryMode/>
        <LastUpdated>2011-12-13T09:18:39.12</LastUpdated>
        <Link>
          <Href>unitoffers/unitoffer/1</Href>
          <Rel>self</Rel>
          <Title>UO1: U1 - CERTIFICATE II IN HOSPITALITY (OPERATIONS)</Title>
        </Link>
        <Location>
          <Description i:nil="true"/>
        </Location>
        <MaximumEnrolments>30</MaximumEnrolments>
        <MinimumEnrolments>1</MinimumEnrolments>
        <Program/>
        <Unit>
          <Code>U1</Code>
          <Description>CERTIFICATE II IN HOSPITALITY (OPERATIONS)</Description>
        </Unit>
        <UnitEnrolmentsLink>
          <Href>unitoffers/unitoffers/enrolments</Href>
          <Rel>enrolments</Rel>
          <Title>All Unit Enrolments</Title>
        </UnitEnrolmentsLink>
        <UnitOfferCode>UO1</UnitOfferCode>
        <UnitOfferId>1</UnitOfferId>
        <UnitOfferPeriod>
          <EndDate>2011-12-03T00:00:00</EndDate>
          <StartDate>2010-12-03T00:00:00</StartDate>
        </UnitOfferPeriod>
        <UnitWebDetails/>
        <UrlEnrol>https://wiseweb2.mywisenet.com.au/wiseweb/login.aspx?key=...</UrlEnrol>
        <Venue/>
        <WebDetails>
          <Name>CERTIFICATE II IN HOSPITALITY (OPERATIONS)</Name>
        </WebDetails>
      </UnitOffer>
    </UnitOffers>
    <Link>
      <Href>/unitoffers/enrolments<Href>
      <Rel>enrolments</Rel>
      <Title>Enrolments</Title>
    </Link>
  </UnitOfferSet>

C# Code Sample

public static void GetUnitOffersSample()
{
    const string url = "https://tst-api.wisenet.co/unitoffers/";
 
    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 Unit Offers

GET /unitoffers/

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

Returns the list of Unit Offers created or modified since the specified date.

The Unit Offers endpoint will filter on the <LastAuditTimestamp> field of each student. This field is set to the current UTC date whenever a student 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/

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

Note: We would recommend that all calls to list unitOffers 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/";
 
    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 ex)
    {
        Console.WriteLine("Error: {0}", ex.Message);
    }
}

List Unit Offers page

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

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

You can combine this request with the additional IfModifiedSince header.

Sample request:

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

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

Read single Unit Offer

GET /unitoffers/unitoffer/{id}

Returns information about the Unit Offer with the specified {id}.

Sample request:

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

Sample response 1:

  <UnitOffer xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://api.mywisenet.com.au/v1/">
    <CourseId>1</CourseId>
    <CourseOfferId>1</CourseOfferId>
    <CourseOfferLink>
      <Href>courseoffers/courseoffer/1</Href>
      <Rel>course-offer</Rel>
      <Title>1 - 1</Title>
    </CourseOfferLink>
    <DeliveryMode/>
    <LastUpdated>2011-12-13T09:18:39.12</LastUpdated>
    <Link>
      <Href>unitoffers/unitoffer/1</Href>
      <Rel>self</Rel>
      <Title>UO1: U1 - CERTIFICATE II IN HOSPITALITY (OPERATIONS)</Title>
    </Link>
    <Location>
      <Description i:nil="true"/>
    </Location>
    <MaximumEnrolments>30</MaximumEnrolments>
    <MinimumEnrolments>1</MinimumEnrolments>
    <Program/>
    <Unit>
      <Code>U1</Code>
      <Description>CERTIFICATE II IN HOSPITALITY (OPERATIONS)</Description>
    </Unit>
    <UnitEnrolmentsLink>
      <Href>unitoffers/unitoffers/enrolments</Href>
      <Rel>enrolments</Rel>
      <Title>All Unit Enrolments</Title>
    </UnitEnrolmentsLink>
    <UnitOfferCode>UO1</UnitOfferCode>
    <UnitOfferId>1</UnitOfferId>
    <UnitOfferPeriod>
      <EndDate>2011-12-03T00:00:00</EndDate>
      <StartDate>2010-12-03T00:00:00</StartDate>
    </UnitOfferPeriod>
    <UnitWebDetails/>
    <UrlEnrol>https://wiseweb2.mywisenet.com.au/wiseweb/login.aspx?key=...</UrlEnrol>
    <Venue/>
    <WebDetails>
      <Name>CERTIFICATE II IN HOSPITALITY (OPERATIONS)</Name>
    </WebDetails>
  </UnitOffer>

Sample response 2: An incorrect ID would return 404 HTTP code.

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

C# Code Sample

private static void ReadSample()
{
    const string url = "https://tst-api.wisenet.co/unitoffers/unitoffer/123";
 
    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);
    }
}
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