The Wisenet Course Enrolments endpoint allows your applications to get information about course enrolments and to submit new course enrolments.
Document Properties
If using xml serialization please order the properties alphabetically.
The following are mandatory for a POST request:
- ContentBase64
- Description
- FileName
The following are optional for a POST request:
- ActivePeriod
- ActiveWiseWebPeriod
- DocumentDate
- IsUReport
- IsVisibleInWiseWebTermsConds
- PublicFlag
The following are returned by GET request:
- DocumentId
- DocumentSize
Add Document for the Course Enrolment
POST /courseoffers/enrolments/enrolment/{enrolmentId}/documents
Inserts a Document into the database and associates this document with the Course Enrolment record.
The Location header in the HTTP response will indicate the URI of the newly created 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":"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 Client"; 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); } }