@_edusign/api
v1.9.0
Published
The Edusign ext API provides an easy way to access your data. Whether it's courses, teachers, or students. You will use library methods to access data stored in the REST API.
Downloads
813
Readme
Edusign library
The Edusign ext API provides an easy way to access your data. Whether it's courses, teachers, or students. You will use library methods to access data stored in the REST API.
Can use this library to build block for apps too https://developers.edusign.com/docs/edusign-application-blocks-tool
Install library :
- NPM
npm i @_edusign/api
- PNPM
pnpm add @_edusign/api
- Yarn
yarn add @_edusign/api
Import library :
It's mandatory to generate an API Key into the Edusign dashboard. Here's the article about how to generate an API Key : https://developers.edusign.com/docs/api-reference
import edusign from "@_edusign/api";
// Create a single edusign client for interacting with Edusign API
const edusignAPI = new edusign.Edusign("API_KEY", "production");
You can check this document to see API possibilities : https://developers.edusign.com/reference
You can follow the same scheme for the other resources in your Edusign account (students, professors, groups, documents, surveys...)
Usage
Here's a list of example snippet to make a request to retrieve, create, update and delete the courses :
// get all courses
const getAllCourses = () => {
// params: page: 2, start: "2020-01-20T15:00:00" (optional), end: "2020-01-20T18:00:00" (optional, filters: "filters" (optional, groupId: "groupId" (optional, studentId: "studentId" (optional
// ⚠️ page param is currently not mandatory but strongly recommended
const courses = (
await edusignAPI
.courses()
.getAll(
2,
"2020-01-20T15:00:00",
"2020-01-20T18:00:00",
"filters",
"groupId",
"studentId"
)
).result;
return courses;
};
getAllCourses();
// get course by Id
const getCourseById = (Id) => {
const course = (await edusignAPI.courses().get(Id)).result;
return course;
};
getCourseById("courseId");
// create course
const createCourse = () => {
const newCourse = {
NAME: "Growth hacking (mandatory)",
DESCRIPTION: "Course about growth hacking",
START: "2020-01-20T15:00:00", // (ISO 8601 datetime)
END: "2020-01-20T18:00:00", // (ISO 8601 datetime)
PROFESSOR: "dfgh6789Uhghj",
PROFESSOR_SIGNATURE: "", // signature URL if the teacher has signed
PROFESSOR_2: "dfgh6789Uhghj",
PROFESSOR_SIGNATURE_2: "", // signature URL if the teacher 2 has signed
PROFESSOR_3: "", // courses can have an infinite number of teachers, ordered by the number at the end of the key
PROFESSOR_SIGNATURE_3: "",
CLASSROOM: "B102",
SCHOOL_GROUP: ["ghj865fgh897Tgh"],
MAX_STUDENTS: 23, // maximum number of students that can be enrolled in the course , optional field
ZOOM: true / false, // Create a zoom meeting and invite all the student to this meeting. /!\ Beta & Only works if you have set up zoom in the settings
API_ID: "", // API ID,
SURVEY_ID: "amsk22ovssga19f", // ID of a survey template (optional)
SURVEY_1_AUTOMATIC_SEND_DATE: "2022-02-23T09:20:00", // automatic sending date of the survey to the participants of the course (optional)
TEACHER_SURVEY: "amsk22ovssga19f", // ID of a survey template for the teacher (optional)
};
const course = (await edusignAPI.courses().add(newCourse)).result;
return course;
};
createCourse();
// update course
const updateCourse = () => {
let updateCourse = {
ID: "45678jhg78",
NAME: "Growth hacking (mandatory)",
DESCRIPTION: "Course about growth hacking",
START: "2020-01-20T15:00:00", // (ISO 8601 datetime)
END: "2020-01-20T18:00:00", // (ISO 8601 datetime)
PROFESSOR: "dfgh6789Uhghj",
PROFESSOR_SIGNATURE: "", // signature URL if the teacher has signed
PROFESSOR_2: "", // second teacher if needed
PROFESSOR_SIGNATURE_2: "", // signature URL if the teacher 2 has signed
PROFESSOR_3: "", // courses can have an infinite number of teachers, ordered by the number at the end of the key
PROFESSOR_SIGNATURE_3: "",
CLASSROOM: "B102", // 255 chars max.
SCHOOL_GROUP: ["ghj865fgh897Tgh"],
SURVEY_ID: "amsk22ovssga19f", // ID of a survey template
SURVEY_1_AUTOMATIC_SEND_DATE: "2022-02-23T09:20:00", // optional automatic sending date of the survey to the participants of the course
ZOOM: true / false, // Create a zoom meeting and invite all the student to this meeting. /!\ Only works if you have set up zoom in the settings
API_ID: "", // API ID
};
const updatedCourse = (await edusignAPI.courses().edit(updateCourse)).result;
return updatedCourse;
};
updateCourse();
// delete course
const deleteCourse = (id) => {
const deleteCourse = (await edusignAPI.courses().delete(id)).result;
return deleteCourse;
};
deleteCourse("courseId");
Supported API
Absences
- Add justified absence
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
const newJustifiedAbsence = {
STUDENT_ID: "advhfjsaa77zc",
COURSE_ID: "ddjdzn8222hhk",
TYPE: 1, // 1 = Sick Leave, 2 = Death of a loved one, 3 = Funeral, 4 = Medical Appointment, 5 = Job interview, 6 = In enterprise, 7 = Other
COMMENT: "The student sent us a medical certificate",
FILE: {
DATA: base64Data, // base64 of the PDF file
NAME: "file_name.pdf", // name of the file
},
API_ID: "", // External ID
API_TYPE: "", // External Type
};
edusignAPI.absences().addJustified(newJustifiedAbsence);
- Add justified absence between two dates
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
const newJustifiedAbsenceBetweenTwoDates = {
STUDENT_ID: "advhfjsaa77zc",
TYPE: 1, // 1 = Sick Leave, 2 = Death of a loved one, 3 = Funeral, 4 = Medical Appointment, 5 = Job interview, 6 = In enterprise, 7 = Other
COMMENT: "The student sent us a medical certificate",
FILE: {
DATA: base64Data, // base64 of the PDF file
NAME: "file_name.pdf", // name of the file
},
DATE_START: "2021-01-01T10:00:00.000Z",
DATE_END: "2021-01-30T10:00:00.000Z",
API_ID: "", // External ID
API_TYPE: "", // External Type
};
edusignAPI.absences().addJustifiedBetweenDates(newJustifiedAbsenceBetweenTwoDates);
- Get all justified absences
// params : page : 1, studentId?: 'studentId (optional), courseId?: 'courseId' (optional)
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI
.absences()
.getAllJustified({ page: 1, studentId: "studentId", courseId: "courseId" });
- Get justified absences by Id
edusignAPI.absences().getById("absenceId");
- Edit justified absence
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
const updateJustifiedAbsence = {
TYPE: 1, // 1 = Sick Leave, 2 = Death of a loved one, 3 = Funeral, 4 = Medical Appointment, 5 = Job interview, 6 = In enterprise, 7 = Other
COMMENT: "The student sent us a medical certificate",
FILE: {
DATA: base64Data, // base64 of the PDF file
NAME: "file_name.pdf", // name of the file
},
DATE_START: "2021-01-01T10:00:00.000Z",
DATE_END: "2021-01-30T10:00:00.000Z",
API_ID: "", // External ID
API_TYPE: "", // External Type
};
edusignAPI.absences().editJustified("absenceId", updateJustifiedAbsence);
- Delete justified absence
edusignAPI.absences().deleteJustified("absenceId");
Absence reasons
- Add absence reasons
const newAbsenceReason = {
NAME: "Sick leave",
ID: 101, // not mandatory, the desired ID of the reason. If it is not supplied, an incremental ID is defined. If the ID linked to the pattern is hidden, we restore it.
};
edusignAPI.absences().addReason(newAbsenceReason);
- Get all absence reasons
edusignAPI.absences().getAllReasons();
- HIde absence reason
edusignAPI.absences().hideAbsenceReason("absenceId");
Courses
- Add course
const newCourse = {
NAME: "Growth hacking (mandatory)",
DESCRIPTION: "Course about growth hacking",
START: "2020-01-20T15:00:00", // (ISO 8601 datetime)
END: "2020-01-20T18:00:00", // (ISO 8601 datetime)
PROFESSOR: "dfgh6789Uhghj",
PROFESSOR_SIGNATURE: "", // signature URL if the teacher has signed
PROFESSOR_2: "dfgh6789Uhghj",
PROFESSOR_SIGNATURE_2: "", // signature URL if the teacher 2 has signed
PROFESSOR_3: "", // courses can have an infinite number of teachers, ordered by the number at the end of the key
PROFESSOR_SIGNATURE_3: "",
CLASSROOM: "B102",
SCHOOL_GROUP: ["ghj865fgh897Tgh"],
MAX_STUDENTS: 23, // maximum number of students that can be enrolled in the course , optional field
ZOOM: true / false, // Create a zoom meeting and invite all the student to this meeting. /!\ Beta & Only works if you have set up zoom in the settings
API_ID: "", // API ID,
SURVEY_ID: "amsk22ovssga19f", // ID of a survey template (optional)
SURVEY_1_AUTOMATIC_SEND_DATE: "2022-02-23T09:20:00", // automatic sending date of the survey to the participants of the course (optional)
TEACHER_SURVEY: "amsk22ovssga19f", // ID of a survey template for the teacher (optional)
};
edusignAPI.courses().add(newCourse);
- Add Student to course
edusignAPI.courses().addStudent("courseId", "studentId");
- Get all courses
// params: page: 2, filters: { start: "2020-01-20T15:00:00" (optional), end: "2020-01-20T18:00:00" (optional, filters: "filters" (optional, groupId: "groupId" (optional, studentId: "studentId" (optional }
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI
.courses()
.getAll(
2,
{
start: "2020-01-20T15:00:00",
end : "2020-01-20T18:00:00",
filters: "filters",
groupId: "groupId",
studentId: "studentId"
}
);
- Get course by Id
edusignAPI.courses().get("courseId");
- Get course by API_Id
edusignAPI.courses().getIdByApiId("course_API_Id");
- Get course by timestamp
edusignAPI.courses().getTimeStamps("courseId");
- Edit course
let updateCourse = {
ID: "45678jhg78",
NAME: "Growth hacking (mandatory)",
DESCRIPTION: "Course about growth hacking",
START: "2020-01-20T15:00:00", // (ISO 8601 datetime)
END: "2020-01-20T18:00:00", // (ISO 8601 datetime)
PROFESSOR: "dfgh6789Uhghj",
PROFESSOR_SIGNATURE: "", // signature URL if the teacher has signed
PROFESSOR_2: "", // second teacher if needed
PROFESSOR_SIGNATURE_2: "", // signature URL if the teacher 2 has signed
PROFESSOR_3: "", // courses can have an infinite number of teachers, ordered by the number at the end of the key
PROFESSOR_SIGNATURE_3: "",
CLASSROOM: "B102", // 255 chars max.
SCHOOL_GROUP: ["ghj865fgh897Tgh"],
SURVEY_ID: "amsk22ovssga19f", // ID of a survey template
SURVEY_1_AUTOMATIC_SEND_DATE: "2022-02-23T09:20:00", // optional automatic sending date of the survey to the participants of the course
ZOOM: true / false, // Create a zoom meeting and invite all the student to this meeting. /!\ Only works if you have set up zoom in the settings
API_ID: "", // API ID
};
edusignAPI.courses().edit(updateCourse, true, "surveyId");
- Delete course
edusignAPI.courses().delete("courseId");
- Get presential sheet by group
edusignAPI.courses().getPresentialSheetByGroup("groupId", "startDate", "endDate");
- Generate pin code
edusignAPI.courses().generatePinCode("courseId");
- Get QR code
edusignAPI.courses().getQRCode("courseId", "professorId");
- Verify QRCode
edusignAPI.courses().verifyQRCode("courseId", "code");
- Get students signature links from course
edusignAPI.courses().getStudentsSignatureLinksFromCourse("courseId");
- Get students signature links between dates
edusignAPI.courses().getStudentsSignatureLinksBetweenDates("startDate", "endDate");
- Get teacher signature links from course
edusignAPI.courses().getTeacherSignatureLinksFromCourse("courseId");
- Lock course : After you lock a course, you will be able to get the attendance sheet PDF URL from the course object.
edusignAPI.courses().lock("courseId");
- unlock course
edusignAPI.courses().unlock("courseId");
- Reload students of a course
edusignAPI.courses().reloadStudents("courseId");
- Remove student from a given course
edusignAPI.courses().removeStudent("courseId", "studentId");
- Send signature emails
edusignAPI.courses().sendSignatureEmails("courseId", "studentId");
- Set absence sent with ERP
edusignAPI.courses().setAbsenceSentWithERP("courseId");
Documents
- Add document
const newDocument = {
"admin_id": "osg53hexfy1w9n1",
"recipients": [
// Each array of recipients represents a document that will be sent. All recipient arrays must be identical (same number of recipients in the same order), only the IDs must be different from one array to another
// document 1
[
{
"category": "student",
"id": "behzfkrghergethgr"
},
{
"category": "professor",
"id": "bhesfsbgksqgrehge"
},
{
"category": "professor",
"id": "fivzjfzbfeehfhfea"
}
],
// document 2
[
{
"category": "student",
"id": "vdnfgkdghergkerghe"
},
{
"category": "professor",
"id": "cehjzferbgekrgjhr"
},
{
"category": "professor",
"id": "vbnfelvfbpdbjrbge"
}
]
],
"inputs": [
{
"category": "student", // Allowed values: "admin", "student", "external", "professor"
"type": "INPUT_TO_FILL", // Allowed values : "INPUT_TO_FILL", "CHECKBOX_TO_FILL", "PARAPHE", "SIGNATURE"
"index": 0,
"label": "Numéro de sécurité sociale", // Text used as the name of the input and who is displayed as a placeholder on the document. This field is required only for input of type "INPUT_TO_FILL"
"position": {
"page": 1,
"x": 100,
"y": 200
}
},
{
"category": "student",
"type": "SIGNATURE",
"index": 0,
"position": {
"page": 2,
"x": 100,
"y": 200
}
},
{
"category": "professor",
"type": "SIGNATURE",
"index": 0, // example : the first professor on the recipient array is index 0, the second professor is index 1 etc
"position": {
"page": 2,
"x": 200,
"y": 50
}
},
{
"category": "professor",
"type": "SIGNATURE",
"index": 1,
"position": {
"page": 2,
"x": 300,
"y": 300
}
},
{
"category": "admin",
"type": "INPUT_TO_FILL",
"index": 0,
"label": "Mention",
"value": "Lu et approuvé"
"position": {
"page": 2,
"x": 50,
"y": 50
}
},
{
"category": "admin",
"type": "SIGNATURE",
"index": 0,
"value": "https://upload.wikimedia.org/wikipedia/commons/9/9c/Signature_de_Amine_Zribi.jpg"
"position": {
"page": 2,
"x": 200,
"y": 400
}
},
],
"sendDocumentToSignByEmail": true // This field is used to choose if the document should be sent by email to all recipients to allow them to sign it. Default: true
"sendDocumentByEmailWhenCompleted": true, // This field is used to choose if the document should be sent by email to all recipients once it is fully signed. Default: true
"signatureValidationMethod": "email", // Allowed values: "email", "sms", "none" (none make the signature validation optional). Default: "email"
"signWithOrder": false, // This field allows to send the document to the recipients one after the other only when the previous recipient has signed
"expirationDate": "2023-01-01T00:00:00+01:00", // This field allows you to define a date from which it will no longer be possible to sign the document
"attachedDocuments": [ // This field allows you to link additional documents (not signable)
{
"name": "mon super annexe",
"url": "https://www.africau.edu/images/default/sample.pdf"
}
],
"sendCustomDocumentEmail": {
"subject": "",
"body": ""
},
"sendCustomSignatureReminderEmail": {
"subject": "",
"body": "",
"amount": 3,
"interval": 24 // in hours
},
"sendCustomEmailWhenDocumentCompleted": {
"subject": "",
"body": ""
},
"document": {
"name": "Convention de formation 2023",
"base64": "xxxxxxxx"
}
};
edusignAPI.documents().add(newDocument);
- Add document from template
const newDocumentWithTemplate = {
"admin": {
"id": "osg53hexfy1w9n1",
"inputs": { // You can use both the label (name) or ID of the input as key
"Signature": "https://upload.wikimedia.org/wikipedia/commons/9/9c/Signature_de_Amine_Zribi.jpg",
"263917": "01/01/2023",
"fin formation": "31/12/2023",
"741293": "40",
"durée de la formation": "12 mois",
"modalité de paiement": "par carte bancaire"
}
},
"recipients": [
// Each array of recipients represents a document that will be sent. All recipient arrays must be identical (same number of recipients in the same order), only the IDs must be different from one array to another
// document 1
[
{
"category": "student", // Allowed values: "student", "external", "professor"
"id": "0prgik79vcfjo1wb"
},
{
"category": "professor",
"id": "r5oppiecwxd13paj"
}
],
// document 2
[
{
"category": "student",
"id": "0prgik79vcfjo1wb"
},
{
"category": "professor",
"id": "cr8apy17yl82675"
}
]
],
"sendDocumentToSignByEmail": true // This field is used to choose if the document should be sent by email to all recipients to allow them to sign it. Default: true
"sendDocumentByEmailWhenCompleted": true, // This field is used to choose if the document should be sent by email to all recipients once it is fully signed. Default: true
"signatureValidationMethod": "email", // Allowed values: "email", "sms", "none" (none make the signature validation optional). Default: "email"
"signWithOrder": false, // This field allows to send the document to the recipients one after the other only when the previous recipient has signed
"expirationDate": "2023-01-01T00:00:00+01:00", // This field allows you to define a date from which it will no longer be possible to sign the document
"attachedDocuments": [ // This field allows you to link additional documents (not signable)
{
"name": "mon super annexe",
"url": "https://www.africau.edu/images/default/sample.pdf"
}
],
"sendCustomDocumentEmail": {
"subject": "",
"body": ""
},
"sendCustomSignatureReminderEmail": {
"subject": "",
"body": "",
"amount": 3,
"interval": 24 // in hours
},
"sendCustomEmailWhenDocumentCompleted": {
"subject": "",
"body": ""
}
};
edusignAPI.documents().addFromTemplate("templateId", newDocumentWithTemplate);
- Get all documents
// optional params getHtml: false, offset: 0, limit: 500, recipientId: 'recipientId', state: 'pending', createdAfter: '2021-01-01T00:00:00', createBefore: '2021-01-01T00:00:00'
edusignAPI.documents().getAll({
getHtml: false,
offset: 0,
limit: 500,
recipientId: "recipientId",
state: "pending",
createdAfter: "2021-01-01T00:00:00",
createBefore: "2021-01-01T00:00:00",
});
- Get document by Id
edusignAPI.documents().get("documentId");
- Delete document
edusignAPI.documents().delete("documentId");
- Generate course summary between dates for professor
edusignAPI
.documents()
.generateCourseSummaryBetweenDatesForProfessor(
"professorId",
"startDate",
"endDate"
);
- Generate course summary between dates for student
edusignAPI
.documents()
.generateCourseSummaryBetweenDatesForStudent(
"studentId",
"startDate",
"endDate",
"groupId"
);
Document directories
- Get all directories
edusignAPI.documents().getAllDirectories();
- Get directory by Id
edusignAPI.documents().getDirectory("directoryId");
Document templates
- Get all document template
edusignAPI.documentTemplates().getAll();
- Get document template by Id
edusignAPI.documentTemplates().get("documentTemplateId");
- Add document template by document Id
edusignAPI.documentTemplates().getByDocumentId("documentId");
- Delete document template
edusignAPI.documentTemplates().delete("documentTemplateId");
Externals
- Add external
const newExternal = {
FIRSTNAME: "Kurt",
LASTNAME: "Cobain",
EMAIL: "[email protected]",
COMPANY: "", // 36 chars max.
TYPE: 0, // 0: unknown, 1 = maitre d'apprentissage, ... // Mandatory
PHONE: "0637625172",
API_ID: "32895Y",
API_TYPE: "test",
};
edusignAPI.externals().add(newExternal);
- Get all external
// optional params keyword The keyword to search FIRSTNAME, LASTNAME, and EMAIL
// ⚠️ keyword param is currently not mandatory but strongly recommended
edusignAPI.externals().getAll(keyword);
- Get external by Id
edusignAPI.externals().get("externalId");
- Get external by email
edusignAPI.externals().byEmail("[email protected]");
- Edit external
const updateExternal = {
ID: "adj82jdflb01k",
FIRSTNAME: "Kurt",
LASTNAME: "Cobain",
EMAIL: "[email protected]",
COMPANY: "",
TYPE: 0, // 0: unknown, 1 = maitre d'apprentissage, 2 = RH... // Mandatory
PHONE: "0637625172",
API_ID: "32895Y",
API_TYPE: "test",
};
edusignAPI.externals().edit(updateExternal);
- Delete external by Id
edusignAPI.externals().delete("externalId");
Groups
- Add group
const newGroup = {
NAME: "Master Digital 2020-2022",
DESCRIPTION: "Whatever you want",
STUDENTS: ["ad876fgh7","gh76th76FG","n876GBnvPPM", ...],
PARENT: "", // If this group is a sub-group, add the id of the parent group
API_ID: "jfgjihgfsc97s", // API ID (if needed)
API_TYPE: "" // Name of the connector linked to
};
edusignAPI.groups().add(newGroup);
- Get all groups
// params page:2
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI.groups().getAll(2);
- Get group by Id
edusignAPI.groups().get("groupId");
- Get group by api_Id
edusignAPI.groups().getIdByApiId("groupApiId");
- Get group by name
edusignAPI.groups().getName("groupName");
- Edit group
const updateGroup = {
ID: "sdfgh67dg67",
NAME: "Master Digital 2020-2022",
DESCRIPTION: "Whatever you want",
STUDENTS: ["gh876fgh7","gh76th76FG","n876GBnvPPM", ...],
PARENT: "" // If this group is a sub-group, add the id of the parent group
}
edusignAPI.groups().edit(updateGroup);
- Delete group
edusignAPI.groups().delete("groupId");
Iot
- Spring card
edusignAPI.iot().springCard("nfc_auth_key", "nfc_mac_address", "nfc_card_Id");
Professors
- Add professor
const newProfessor = {
FIRSTNAME: "Bob",
LASTNAME: "Dylan",
EMAIL: "[email protected]",
SPECIALITY: "Marketing",
API_ID: "f0js9Uj", // API ID of the teacher (can be used to make a link with your service)
API_TYPE: "hyperplanning", // Name of the connector associated with the API ID (do not use if you don't know)
TAGS: ["tag1", "tag2", "..."],
VARIABLES: [
// Table of additional data for the professor, must have been created first in the Interface of Edusign
{
NAME: "Identifiant",
VALUE: "ar82U1kk",
RESSOURCE_TYPE: "professor",
},
],
};
edusignAPI.professors().add(newProfessor);
- Get all professors
// params page:2
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI.professors().getAll(1);
- Get professor by Id
edusignAPI.professors().get("professorId");
- Get professor by API_Id
edusignAPI.professors().getIdByApiId("professorId");
- Get professor by Email
edusignAPI.professors().byEmail("[email protected]");
- Edit professor
const updateProfessor = {
ID: "567yhgf567",
FIRSTNAME: "Paul",
LASTNAME: "McCartney",
EMAIL: "[email protected]",
SPECIALITY: "Marketing",
API_ID: "f0js9Uj", // API ID of the teacher (can be used to make a link with your service)
API_TYPE: "hyperplanning", // Name of the connector associated with the API ID (do not use if you don't know)
TAGS: ["tag1", "tag2", "..."],
VARIABLES: [
// Table of additional data for the professor, must have been created first in the Interface of Edusign
{
NAME: "Identifiant",
VALUE: "ar82U1kk",
RESSOURCE_TYPE: "professor",
},
],
};
edusignAPI.professors().edit(updateProfessor);
- Delete professor
edusignAPI.professors().delete("professorId"); // ⚠️ WARNING! Never delete a teacher who is used in a group or a course!
Professor variables
- Add professor variable
edusignAPI
.professors()
.addNewVariable("professorId", "variable_name", "variable_value");
- Get professor variable
edusignAPI.professors().getVariables("professorId");
- Edit professor variable
edusignAPI
.professors()
.editVariable("professorId", "variableId", "variable_name", "variable_value");
- Delete professor variable
edusignAPI.professors().deleteVariable("variableId");
Schools
- Get school
edusignAPI.school().get();
- Get daily courses
edusignAPI.school().getDailyCourses("schoolId");
- Edit school
const updateSchool = {
NAME: "My super school",
LOGO: "https://", // url of the main logo
LOGOS: [{url: "https://", filename: "my_logo.png"}], // others logos used by the school
STREET_ADDRESS: "1 avenue des champs élysées",
CITY: "Paris",
POSTALCODE: "75008",
COUNTRY: "France",
PHONE: "01 00 00 00 00 00",
WEBHOOKS: [{"type":"on_student_sign","url":"https://webhook.site/abc"}, ...] // array of webhooks used in the school
};
edusignAPI.school().edit(updateSchool);
Students
- Add student
const newStudent = {
FIRSTNAME: "Kurt",
LASTNAME: "Cobain",
EMAIL: "[email protected] (mandatory)",
FILE_NUMBER: "4567098547",
PHOTO: "https://randomuser.me/api/portraits/men/64.jpg",
PHONE: "+33782576806",
GROUPS: ["groupIds"],
TRAINING_NAME: "Master 1 Digital",
COMPANY: "Edusign", // student's company (if apprenticeship or continuing education)
TAGS: ["tag 1", "tag 2"],
SEND_EMAIL_CREDENTIALS: true, // if true it will send an email to the student with his credentials
API_ID: "f0js9Uj", // External ID of the student (can be used to make a link with your service)
API_TYPE: "hyperplanning", // Name of the connector associated with the external ID (do not use if you don't know)
BADGE_ID: "1234567", // ID of NFC card (if needed)
STUDENT_FOLLOWER_ID: [], // ID of externals (see external section) that follows the student (Tuteur, Maitre d'apprentissage...)
NEW_PASSWORD_NEEDED: true,
};
edusignAPI.students().add(newStudent);
- get all students
// params page:2
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI.students().getAll(2);
- get student by id
edusignAPI.students().get("studentId");
- get student by email
edusignAPI.students().byEmail("[email protected]");
- get student by API_ID
edusignAPI.students().getIdByApiId("studentApiId");
- Get presence summary
edusignAPI.students().getPresenceSummary("studentId", "startDate", "endDate");
- Edit student
const updateStudent = {
ID: "45ygb678h6G6",
FIRSTNAME: "Jimi",
LASTNAME: "Hendrix",
EMAIL: "[email protected]",
FILE_NUMBER: "4567098547",
PHOTO: "https://randomuser.me/api/portraits/men/64.jpg",
HIDDEN: false, // true if the student is soft deleted (archived) - Use endpoint "restore a student " to unarchive it /!\
GROUPS: ["groupIds"],
PHONE: "+33782576806",
TRAINING_NAME: "Master 1 Digital",
COMPANY: "Edusign", // student's company (if apprenticeship or continuing education)
TAGS: ["Tag 1", "Tag 2"],
API_ID: "f0js9Uj", // External ID of the student (can be used to make a link with your service)
API_TYPE: "hyperplanning", // Name of the connector associated with the external ID (do not use if you don't know)
BADGE_ID: "123456", // ID of NFC card (if needed)
STUDENT_FOLLOWER_ID: [], // ID of externals (see external section) that follows the student (Tuteur, Maitre d'apprentissage...)
};
edusignAPI.students().edit(updateStudent);
- Archive student
edusignAPI.students().archive("studentId");
- Restore student
edusignAPI.students().restore("studentId");
Student relations
- Add student's external relation
edusignAPI
.students()
.addExternalRelation("studentId", "externalId", "relationType");
- Get student's external relation
edusignAPI.students().getRelations("studentId");
- Delete student's external relation
edusignAPI.students().deleteRelation("studentId", "externalId");
Student variables
- Add student variable
edusignAPI.students().addVariable("studentId", "variable_name", "variable_value");
- Get student variable
edusignAPI.students().getVariables("studentId");
- Edit student variable
edusignAPI
.students()
.editVariable("studentId", "variableId", "variable_name", "variable_value");
- Delete student variable
edusignAPI.students().deleteVariable("variableId");
Surveys
- Add survey
const newSurvey = {
survey: "dkjaja181Iddk1", // Template ID of the survey used (in the URL when you create/edita survey in the edusign platform)
students: ["6dkfds1jj822", "aksj6djf911ed", "901ml6ddj18"], // Array of id of the students
professors: ["6djaie7jj822", "aksj6djj39dja", "ja8926ddj18"], // Array of id of the professors
sending_date: "2021-03-20T15:00:00 (ISO 8601 datetime)", // Schedule a sending date. If it's empty, the survey is sent immediately.
};
edusignAPI.surveys().add(newSurvey);
- Get all surveys
edusignAPI.surveys().getAll();
- Get survey by Id
edusignAPI.surveys().get("surveyId");
- Delete survey
edusignAPI.surveys().delete("surveyId");
- Send reminder
edusignAPI.surveys().sendReminder("surveyId");
- Get all templates
edusignAPI.surveys().getAllTemplates();
- Generate PDF from student answers
edusignAPI.surveys().generatePDFFromStudentAnswers("surveyId", "studentId");
Users
- Add user
const newUser = {
CREATOR_NAME: "John Doe", // Name of the person who creates the account (if empty = "WEB SERVICES") - used in the welcome email.
NAME: "Kurt Cobain",
EMAIL: "[email protected]",
PHONE: "+33 6 12 34 56 78", // Phone number , optional field
PERMISSIONS: 2, 0-5 : 0 = viewer, 1 = user, 4 = admin, 5 = Owner. (2-3 are not currently used, atempting to use them will result in a user created with permissions 1)
};
edusignAPI.users().add(newUser);
- Get all users
edusignAPI.users().getAll();
- Delete user
edusignAPI.users().delete("userId");
- Change user's permissions
edusignAPI.users().changePermissions("userId", 3); // permissions: 0 | 1 | 2 | 3 | 4 | 5
Utils
- Get inputs from Adobe document
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
edusignAPI.utils().getInputsFromAdobeDocument(base64Data);
- Get inputs from document text
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
edusignAPI.utils().getInputsFromDocumentText(base64Data);
Classrooms
- Add classroom
edusignAPI.classrooms().add("classroom_add");
- Get all classrooms
edusignAPI.classrooms().getAll();
- Get classroom by name
edusignAPI.classrooms().getByName("classroom_name");
- Update classroom
edusignAPI.classrooms().update("classroom_id", "classroom_name");
- Delete classroom by id
edusignAPI.classrooms().delete("classroom_id");
- Delete classroom by name
edusignAPI.classrooms().deleteByName("classroom_name");
Presential states
- Set student absent
edusignAPI
.presentialStates()
.setStudentAbsent("student_id", "course_id", "comment");
- Set student delayed
edusignAPI
.presentialStates()
.setStudentDelayed("student_id", "course_id", 30, "comment"); // 30 is delay in minutes
- Set student early departure
edusignAPI
.presentialStates()
.setStudentEarlyDeparture("student_id", "course_id", "early_date", "comment");
- Set student comment
edusignAPI
.presentialStates()
.setStudentComment("student_id", "course_id", "comment");
- Set student excluded
edusignAPI
.presentialStates()
.setStudentExcluded("student_id", "course_id", "excludeDate", "comment");
- Set student present
edusignAPI.presentialStates().setStudentPresent("course_id", "student_id");
Deprecated
- Delete document
edusignAPI.deprecated().deleteDocument("document_id");
- Get all document
edusignAPI
.deprecated()
.getAllDocuments(
`optional : {studentId?: 'studentId', start?: 'startDate', end?: 'enddate'}`
);
- Get document by Id
edusignAPI.deprecated().getDocumentById("document_id");
- Get all document templates
edusignAPI.deprecated().getAllDocumentTemplates();
- Send template to sign
const template = {
user_id: "2gb2fc6a11edb",
sendDocumentToRecipients: true, // if true, send the signed document to the recipients once the document is signed
templateId: "", // template ID
adminSignature: {
name: "Dylan Teixeira", // your admin signatory name
email: "[email protected]", // your admin signatory email
signature: "https://edusign-sign.s3.eu-west-3.amazonaws.com/ac81505d3ecb669e8aa1a7f43e8055b25d3d029c00e58ea514cf28f02f40f8d4.jpg" // fill with your admin URL signature
},
signatory: {
type: "students", // or "externals" if there is no student that needs to sign the document
id: "fhdehj8H4sq2", // id of the student that has to sign the document (max 1 student)
externalsId: [] // Id of the external signatories for the document (optional)
},
redirectionLinkOnceSigned: "", // used to specify an URL where to redirect the user once he has signed
validateSignatureBy: "email" // use "email" or "sms" to choose the method for sending the signature validation code or "none" to deactivate the option
emailReminder: {
subject: "", // objet du mail
message: "", // corps du mail
amount: 3, // maximum 5
interval: 1 // in hours
},
fields: { // If your template has fields that has to be filled, please provide an object with the "name" of the field. If all the field are not filled, the API will respond an array with the fields to fill
"debut coaching": "12/12/2021",
"fin coaching": "23/12/2021"
},
directoryId: "" // ID of a directory
};
edusignAPI.deprecated().sendTemplateToSign(template);
- Send document to sign
const document = {
students: ["a72344hzzaa", "2983I902ksdf"], // ID of the students that will receive and sign the document (One document per student).
user_id: "2gb2fc6a99edb",
fields: {
// If your template has fields that has to be filled, please provide an object with the "name" of the field. If all the field are not filled, the API will respond an array with the fields to fill
"input_date debut coaching": "12/12/2021",
"input_date fin coaching": "23/12/2021",
},
admin_signature:
"https://upload.wikimedia.org/wikipedia/commons/6/68/Justin_Timberlake_signature.jpg", // admin signature (if needed in the template)
sendDocumentToStudent: true, // if true, send the signed document to the student,
validateSignatureBy: "email", // use "email" or "sms" to choose the method for sending the signature validation code or "none" to deactivate the option
};
edusignAPI.deprecated().sendDocumentToSign(document);
- Send document without template
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
const document = {
user_id: "2gb2fc6a11edb",
document: {
name: "file_name.pdf",
base64: base64Data,
},
sendDocumentToRecipients: true, // if true, send the signed document to the recipients once the document is signed
signatories: [
{
type: "student", // or "external"
id: "fhdehj8H4sq2", // id of the student that has to sign the document (max 1 student)
elements: [
{
type: "",
position: {
page: "",
x: "",
y: "",
},
},
],
},
],
redirectionLinkOnceSigned: "", // used to specify an URL where to redirect the user once he has signed
validateSignatureBy: "email", // use "email" or "sms" to choose the method for sending the signature validation code or "none" to deactivate the option
emailReminder: {
subject: "", // objet du mail
message: "", // corps du mail
amount: 3, // maximum 5
interval: 1, // in hours
},
directoryId: "", // ID of a directory
};
edusignAPI.deprecated().sendDocumentWithoutTemplate(document);
- Get justified absence by Id
edusignAPI.deprecated().getJustifiedAbsenceById("absence_id");
Maintainers
This repo is developed and maintained by Edusign.