Search in sources :

Example 41 with Student

use of com.instructure.canvasapi2.models.Student in project tutorials by eugenp.

the class StudentController method create.

public Result create() {
    JsonNode json = request().body().asJson();
    if (json == null) {
        return badRequest(Util.createResponse("Expecting Json data", false));
    }
    Student student = StudentStore.getInstance().addStudent(Json.fromJson(json, Student.class));
    JsonNode jsonObject = Json.toJson(student);
    return created(Util.createResponse(jsonObject, true));
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) Student(models.Student)

Aggregations

Enrollment (com.instructure.canvasapi2.models.Enrollment)24 Course (com.instructure.canvasapi2.models.Course)23 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)21 Student (com.instructure.canvasapi2.models.Student)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 ApiPrefs (com.instructure.canvasapi2.utils.ApiPrefs)4 ApiType (com.instructure.canvasapi2.utils.ApiType)4 Prefs (com.instructure.pandautils.utils.Prefs)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)3 Student (models.Student)3 Before (org.junit.Before)3 NonNull (android.support.annotation.NonNull)2 StatusCallback (com.instructure.canvasapi2.StatusCallback)2 BlockedStudentResponse (com.instructure.canvasapi2.models.BlockedStudentResponse)2 MismatchedRegionResponse (com.instructure.canvasapi2.models.MismatchedRegionResponse)2 ParentResponse (com.instructure.canvasapi2.models.ParentResponse)2 RevokedTokenResponse (com.instructure.canvasapi2.models.RevokedTokenResponse)2 Response (okhttp3.Response)2