WiseNET.API - Course Enrolments Documents Endpoint

From Wisenet Resource Centre
Jump to: navigation, search


The Wise.NET CourseIn Wise.NET a course is usually a qualification or short course Enrolments endpoint allows your applications to get information about course enrolments and to submit new course enrolments.

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

Contents

Related Endpoints

Document Properties

If using xml serialization please order the properties alphabetically.


The following are mandatory for a POST request:


The following are optional for a POST request:


The following are returned by GET request:

Add Document for the CourseIn Wise.NET a course is usually a qualification or short course Enrolment

 POST /courseoffers/enrolments/enrolment/{enrolmentId}/documents

Inserts a Document into the database and associates this document with the CourseIn Wise.NET a course is usually a qualification or short course Enrolment record.

The Location header in the HTTP response will indicate the URI of the newly created CourseIn Wise.NET a course is usually a qualification or short course Enrolment resource.

Sample request:

 curl -X POST \
   -H "Accept: application/json" -H "Content-Type: application/json"
   -d @PostCorDocument.json.new \
   -v \
   https://tst-api.wisenet.co/courseoffers/enrolments/enrolment/1097/documents

PostCorDocument.json.new:

{
	"ContentBase64":"MTIzNDU2Nzg5MA0KMTIzNDU2Nzg5MA0KMTIzNDU2Nzg5MA0KMTIzNDU2Nzg5MA0KMTIzNDU2Nzg5
MA0KDQo=",
	"Description":"New Doc Descr",
	"PublicFlag":true,
	"ActivePeriod":{
		"StartDate":"\/Date(1333061075507+1100)\/",
		"EndDate":"\/Date(1333061075507+1100)\/"
	},
	"IsVisibleInWiseWebTermsConds":true,
	"ActiveWiseWebPeriod":{
		"StartDate":"\/Date(1333061075507+1100)\/",
		"EndDate":"\/Date(1333061075507+1100)\/"
	},
	"IsUReport":true,
	"DocumentDate":"\/Date(1333061075507+1100)\/",
	"FileName":"Api.NewFileName.123.txt"
}

The ContentBase64 above is the base64-encoded value of

1234567890<CR><LF>
1234567890<CR><LF>
1234567890<CR><LF>
1234567890<CR><LF>
1234567890<CR><LF>
<CR><LF>

The Api will return newly created Document's record, with DocumentSize but without ContentBase64.

You might want to keep DocumentId from that response for your records.

Sample response:

{
	"ActivePeriod":{
		"EndDate":"\/Date(1333061075507+1100)\/",
		"StartDate":"\/Date(1333061075507+1100)\/"
	},
	"ActiveWiseWebPeriod":{
		"EndDate":"\/Date(1333061075507+1100)\/",
		"StartDate":"\/Date(1333061075507+1100)\/"
	},
	"Description":"New Doc Descr",
	"DocumentDate":"\/Date(1399255040010+1000)\/",
	"DocumentId":2254,
	"DocumentSize":62,
	"FileName":"Api.NewFileName.123(6).txt",
	"IsVisibleInWiseWebTermsConds":true,
	"MasterObjectId":1097,
	"MasterObjectType":"CourseIn Wise.NET a course is usually a qualification or short course Enrolment",
	"PublicFlag":true
}

C# Code Sample

private static void AddSample()
{
    const string url = "https://tst-api.wisenet.co/CourseOffers/enrolments/";
 
    var request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.ContentType = "application/json";
    request.Method = "POST";
    request.UserAgent = "C# Sample ClientIn Wise.NET a client is a student, trainee or apprentice";
 
    byte[] byteData = File.ReadAllBytes("PostCorDocument.json.new");
 
    // 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);
    }
}
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