All URIs are relative to https://api.flat.io/v2
Method | HTTP request | Description |
---|---|---|
activateClass | POST /classes/{class}/activate | Activate the class |
addClassUser | PUT /classes/{class}/users/{user} | Add a user to the class |
archiveClass | POST /classes/{class}/archive | Archive the class |
copyAssignment | POST /classes/{class}/assignments/{assignment}/copy | Copy an assignment |
createAssignment | POST /classes/{class}/assignments | Assignment creation |
createClass | POST /classes | Create a new class |
createSubmission | PUT /classes/{class}/assignments/{assignment}/submissions | Create or edit a submission |
deleteClassUser | DELETE /classes/{class}/users/{user} | Remove a user from the class |
editSubmission | PUT /classes/{class}/assignments/{assignment}/submissions/{submission} | Edit a submission |
enrollClass | POST /classes/enroll/{enrollmentCode} | Join a class |
getClass | GET /classes/{class} | Get the details of a single class |
getScoreSubmissions | GET /scores/{score}/submissions | List submissions related to the score |
getSubmission | GET /classes/{class}/assignments/{assignment}/submissions/{submission} | Get a student submission |
getSubmissions | GET /classes/{class}/assignments/{assignment}/submissions | List the students' submissions |
listAssignments | GET /classes/{class}/assignments | Assignments listing |
listClassStudentSubmissions | GET /classes/{class}/students/{user}/submissions | List the submissions for a student |
listClasses | GET /classes | List the classes available for the current user |
unarchiveClass | DELETE /classes/{class}/archive | Unarchive the class |
updateClass | PUT /classes/{class} | Update the class |
ClassDetails activateClass(_class)
Activate the class
Mark the class as `active`. This is mainly used for classes synchronized from Clever that are initially with an `inactive` state and hidden in the UI.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.activateClass(_class, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class |
- Content-Type: application/json
- Accept: application/json
addClassUser(_class, user)
Add a user to the class
This method can be used by a teacher of the class to enroll another Flat user into the class. Only users that are part of your Organization can be enrolled in a class of this same Organization. When enrolling a user in the class, Flat will automatically add this user to the corresponding Class group, based on this role in the Organization.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var user = "user_example"; // String | Unique identifier of the user
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
apiInstance.addClassUser(_class, user, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
user | String | Unique identifier of the user |
null (empty response body)
- Content-Type: application/json
- Accept: application/json
ClassDetails archiveClass(_class)
Archive the class
Mark the class as `archived`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.archiveClass(_class, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class |
- Content-Type: application/json
- Accept: application/json
Assignment copyAssignment(_class, assignment, body)
Copy an assignment
Copy an assignment to a specified class. If the original assignment has a due date in the past, this new assingment will be created without a due date. If the new class is synchronized with an external app (e.g. Google Classroom), the copied assignment will also be posted on the external app.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var assignment = "assignment_example"; // String | Unique identifier of the assignment
var body = new FlatApi.AssignmentCopy(); // AssignmentCopy |
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.copyAssignment(_class, assignment, body, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
assignment | String | Unique identifier of the assignment | |
body | AssignmentCopy |
- Content-Type: application/json
- Accept: application/json
Assignment createAssignment(_class, opts)
Assignment creation
Use this method as a teacher to create and post a new assignment to a class. If the class is synchronized with Google Classroom, the assignment will be automatically posted to your Classroom course.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var opts = {
'body': new FlatApi.AssignmentCreation() // AssignmentCreation |
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.createAssignment(_class, opts, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
body | AssignmentCreation | [optional] |
- Content-Type: application/json
- Accept: application/json
ClassDetails createClass(body)
Create a new class
Classrooms on Flat allow you to create activities with assignments and post content to a specific group. When creating a class, Flat automatically creates two groups: one for the teachers of the course, one for the students. The creator of this class is automatically added to the teachers group. If the classsroom is synchronized with another application like Google Classroom, some of the meta information will automatically be updated. You can add users to this class using `POST /classes/{class}/users/{user}`, they will automatically added to the group based on their role on Flat. Users can also enroll themselves to this class using `POST /classes/enroll/{enrollmentCode}` and the `enrollmentCode` returned in the `ClassDetails` response.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var body = new FlatApi.ClassCreation(); // ClassCreation |
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.createClass(body, callback);
Name | Type | Description | Notes |
---|---|---|---|
body | ClassCreation |
- Content-Type: application/json
- Accept: application/json
AssignmentSubmission createSubmission(_class, assignment, body)
Create or edit a submission
Use this method as a student to create, update and submit a submission related to an assignment. Students can only set `attachments`, `studentComment` and `submit`. Teachers can use `PUT /classes/{class}/assignments/{assignment}/submissions/{submission}` to update a submission by id.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var assignment = "assignment_example"; // String | Unique identifier of the assignment
var body = new FlatApi.AssignmentSubmissionUpdate(); // AssignmentSubmissionUpdate |
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.createSubmission(_class, assignment, body, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
assignment | String | Unique identifier of the assignment | |
body | AssignmentSubmissionUpdate |
- Content-Type: application/json
- Accept: application/json
deleteClassUser(_class, user)
Remove a user from the class
This method can be used by a teacher to remove a user from the class, or by a student to leave the classroom. Warning: Removing a user from the class will remove the associated resources, including the submissions and feedback related to these submissions.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var user = "user_example"; // String | Unique identifier of the user
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
apiInstance.deleteClassUser(_class, user, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
user | String | Unique identifier of the user |
null (empty response body)
- Content-Type: application/json
- Accept: application/json
AssignmentSubmission editSubmission(_class, assignment, submission, body)
Edit a submission
Use this method as a teacher to update the different submission and give feedback. Teachers can only set `returnFeedback`
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var assignment = "assignment_example"; // String | Unique identifier of the assignment
var submission = "submission_example"; // String | Unique identifier of the submission
var body = new FlatApi.AssignmentSubmissionUpdate(); // AssignmentSubmissionUpdate |
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.editSubmission(_class, assignment, submission, body, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
assignment | String | Unique identifier of the assignment | |
submission | String | Unique identifier of the submission | |
body | AssignmentSubmissionUpdate |
- Content-Type: application/json
- Accept: application/json
ClassDetails enrollClass(enrollmentCode)
Join a class
Use this method to join a class using an enrollment code given one of the teacher of this class. This code is also available in the `ClassDetails` returned to the teachers when creating the class or listing / fetching a specific class. Flat will automatically add the user to the corresponding class group based on this role in the organization.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var enrollmentCode = "enrollmentCode_example"; // String | The enrollment code, available to the teacher in `ClassDetails`
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.enrollClass(enrollmentCode, callback);
Name | Type | Description | Notes |
---|---|---|---|
enrollmentCode | String | The enrollment code, available to the teacher in `ClassDetails` |
- Content-Type: application/json
- Accept: application/json
ClassDetails getClass(_class)
Get the details of a single class
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getClass(_class, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class |
- Content-Type: application/json
- Accept: application/json
[AssignmentSubmission] getScoreSubmissions(score)
List submissions related to the score
This API call will list the different assignments submissions where the score is attached. This method can be used by anyone that are part of the organization and have at least read access to the document.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var score = "score_example"; // String | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`).
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getScoreSubmissions(score, callback);
Name | Type | Description | Notes |
---|---|---|---|
score | String | Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`). |
- Content-Type: application/json
- Accept: application/json
AssignmentSubmission getSubmission(_class, assignment, submission)
Get a student submission
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var assignment = "assignment_example"; // String | Unique identifier of the assignment
var submission = "submission_example"; // String | Unique identifier of the submission
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getSubmission(_class, assignment, submission, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
assignment | String | Unique identifier of the assignment | |
submission | String | Unique identifier of the submission |
- Content-Type: application/json
- Accept: application/json
[AssignmentSubmission] getSubmissions(_class, assignment)
List the students' submissions
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var assignment = "assignment_example"; // String | Unique identifier of the assignment
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getSubmissions(_class, assignment, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
assignment | String | Unique identifier of the assignment |
- Content-Type: application/json
- Accept: application/json
[Assignment] listAssignments(_class)
Assignments listing
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.listAssignments(_class, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class |
- Content-Type: application/json
- Accept: application/json
[AssignmentSubmission] listClassStudentSubmissions(_class, user)
List the submissions for a student
Use this method as a teacher to list all the assignment submissions sent by a student of the class
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var user = "user_example"; // String | Unique identifier of the user
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.listClassStudentSubmissions(_class, user, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
user | String | Unique identifier of the user |
- Content-Type: application/json
- Accept: application/json
[ClassDetails] listClasses(opts)
List the classes available for the current user
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var opts = {
'state': "active" // String | Filter the classes by state
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.listClasses(opts, callback);
Name | Type | Description | Notes |
---|---|---|---|
state | String | Filter the classes by state | [optional] [default to active] |
- Content-Type: application/json
- Accept: application/json
ClassDetails unarchiveClass(_class)
Unarchive the class
Mark the class as `active`. When this course is synchronized with another app, like Google Classroom, this state will be automatically be updated.
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.unarchiveClass(_class, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class |
- Content-Type: application/json
- Accept: application/json
ClassDetails updateClass(_class, opts)
Update the class
Update the meta information of the class
var FlatApi = require('flat-api');
var defaultClient = FlatApi.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = 'YOUR ACCESS TOKEN';
var apiInstance = new FlatApi.ClassApi();
var _class = "_class_example"; // String | Unique identifier of the class
var opts = {
'body': new FlatApi.ClassUpdate() // ClassUpdate | Details of the Class
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.updateClass(_class, opts, callback);
Name | Type | Description | Notes |
---|---|---|---|
_class | String | Unique identifier of the class | |
body | ClassUpdate | Details of the Class | [optional] |
- Content-Type: application/json
- Accept: application/json