Edusig 库
Edusign ext API 为访问您的数据提供了简单的方式. 无论是课程,老师,还是学生. 您将使用库方法访问存储在 REST API 中的数据 .
也可以使用此库来构建应用程序的块 https://developers.edusign.com/docs/edusign-application-blocks-tool (中文(简体) )
安装库 :
- 国家预防机制
npm i @_edusign/api
- 菲律宾
pnpm add @_edusign/api
- 雅伦
yarn add @_edusign/api
导入库 :
在Edusign仪表板中必须生成一个API密钥. 以下是关于如何生成 API 密钥的文章 : https://developers.edusign.com/docs/api-参考资料
import edusign from "@_edusign/api";
// Create a single edusign client for interacting with Edusign API
const edusignAPI = new edusign.Edusign("API_KEY", "production");
您可以检查此文档以查看 API 可能性 : https://developers.edusign.com/ 参考资料
您可以在您的 Edusign 账户( 学生、 教授、 团体、 文件、 调查...) 中遵循同样的方案
使用量
以下是一个实例片段列表
// 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");
支持的 API
缺额
- 加有正当理由缺席
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);
- 在两个日期之间添加有正当理由的缺席
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);
- 得到所有合理的缺席
// 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" });
- 以 Id 为理由缺席
edusignAPI.absences().getById("absenceId");
- 编辑有正当理由的缺席
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);
- 删除有正当理由的缺席
edusignAPI.absences().deleteJustified("absenceId");
缺席原因
- 添加缺席原因
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);
- 得到所有缺席的理由
edusignAPI.absences().getAllReasons();
- HIDE 缺席的原因
edusignAPI.absences().hideAbsenceReason("absenceId");
课程
- 添加课程
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);
- 在课程中添加学生
edusignAPI.courses().addStudent("courseId", "studentId");
- 上所有课程
// 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"
}
);
- 沿着路走
edusignAPI.courses().get("courseId");
- 由 API Id 引导
edusignAPI.courses().getIdByApiId("course_API_Id");
- 按时间戳走
edusignAPI.courses().getTimeStamps("courseId");
- 编辑课程
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");
- 删除课程
edusignAPI.courses().delete("courseId");
- 按组获取当前工作表
edusignAPI.courses().getPresentialSheetByGroup("groupId", "startDate", "endDate");
- 生成指针代码
edusignAPI.courses().generatePinCode("courseId");
- 获取 QR 代码
edusignAPI.courses().getQRCode("courseId", "professorId");
- 校验 QRCde
edusignAPI.courses().verifyQRCode("courseId", "code");
- 从课程中获取学生签名链接
edusignAPI.courses().getStudentsSignatureLinksFromCourse("courseId");
- 在日期之间取得学生签名链接
edusignAPI.courses().getStudentsSignatureLinksBetweenDates("startDate", "endDate");
- 从课程中获取老师签名链接
edusignAPI.courses().getTeacherSignatureLinksFromCourse("courseId");
- 锁定课程 : 锁定课程后, 您可以从课程对象中获取出勤表 PDF URL .
edusignAPI.courses().lock("courseId");
- 解锁课程
edusignAPI.courses().unlock("courseId");
- 重新装入课程的学生
edusignAPI.courses().reloadStudents("courseId");
- 从给定的课程中删除学生
edusignAPI.courses().removeStudent("courseId", "studentId");
- 发送签名邮件
edusignAPI.courses().sendSignatureEmails("courseId", "studentId");
- 设置与企业资源规划一起发送的缺失
edusignAPI.courses().setAbsenceSentWithERP("courseId");
文档
- 添加文档
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);
- 从模板中添加文档
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);
- 获取所有文档
// 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",
});
- 由 ID 获取文档
edusignAPI.documents().get("documentId");
- 删除文档
edusignAPI.documents().delete("documentId");
- 在教授日期之间生成课程摘要
edusignAPI
.documents()
.generateCourseSummaryBetweenDatesForProfessor(
"professorId",
"startDate",
"endDate"
);
- 在学生之间生成课程摘要
edusignAPI
.documents()
.generateCourseSummaryBetweenDatesForStudent(
"studentId",
"startDate",
"endDate",
"groupId"
);
文档目录
- 获取全部目录
edusignAPI.documents().getAllDirectories();
- 由 ID 获取目录
edusignAPI.documents().getDirectory("directoryId");
文件模板
- 获取全部文档模板
edusignAPI.documentTemplates().getAll();
- 由 Id 获取文档模板
edusignAPI.documentTemplates().get("documentTemplateId");
- 通过文件 Id 添加文档模板
edusignAPI.documentTemplates().getByDocumentId("documentId");
- 删除文档模板
edusignAPI.documentTemplates().delete("documentTemplateId");
外部人员
- 添加外部
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);
- 获取所有外部
// optional params keyword The keyword to search FIRSTNAME, LASTNAME, and EMAIL
// ⚠️ keyword param is currently not mandatory but strongly recommended
edusignAPI.externals().getAll(keyword);
- 由 Id 获取外部
edusignAPI.externals().get("externalId");
- 通过电子邮件获取外部
edusignAPI.externals().byEmail("[email protected]");
- 编辑外部
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);
- 由 Id 删除外部
edusignAPI.externals().delete("externalId");
组
- 添加组
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);
- 获取所有组
// params page:2
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI.groups().getAll(2);
- 由 Id 组合
edusignAPI.groups().get("groupId");
- 由 api Id 组合
edusignAPI.groups().getIdByApiId("groupApiId");
- 按名称获取组
edusignAPI.groups().getName("groupName");
- 编辑组
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);
- 删除组
edusignAPI.groups().delete("groupId");
经常
- 春季卡
edusignAPI.iot().springCard("nfc_auth_key", "nfc_mac_address", "nfc_card_Id");
教授
- 添加教授
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);
- 找所有教授来
// params page:2
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI.professors().getAll(1);
- 找博士来
edusignAPI.professors().get("professorId");
- 通过 API Id 获得教授
edusignAPI.professors().getIdByApiId("professorId");
- 通过电子邮件找教授
edusignAPI.professors().byEmail("[email protected]");
- 编辑教授
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);
- 删除教授
edusignAPI.professors().delete("professorId"); // ⚠️ WARNING! Never delete a teacher who is used in a group or a course!
教授变量
- 添加教授变量
edusignAPI
.professors()
.addNewVariable("professorId", "variable_name", "variable_value");
- 获取教授变量
edusignAPI.professors().getVariables("professorId");
- 编辑教授变量
edusignAPI
.professors()
.editVariable("professorId", "variableId", "variable_name", "variable_value");
- 删除教授变量
edusignAPI.professors().deleteVariable("variableId");
学校
- 上学吧
edusignAPI.school().get();
- 每日课程
edusignAPI.school().getDailyCourses("schoolId");
- 编辑学校
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);
学生
- 添加学生
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);
- 让所有的学生
// params page:2
// ⚠️ page param is currently not mandatory but strongly recommended
edusignAPI.students().getAll(2);
- 让学生通过id
edusignAPI.students().get("studentId");
- 通过电子邮件获得学生
edusignAPI.students().byEmail("[email protected]");
- 由 API ID 获取学生
edusignAPI.students().getIdByApiId("studentApiId");
- 获取存在摘要
edusignAPI.students().getPresenceSummary("studentId", "startDate", "endDate");
- 编辑学生
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);
- 存档学生
edusignAPI.students().archive("studentId");
- 恢复学生
edusignAPI.students().restore("studentId");
学生关系
- 添加学生的外部关系
edusignAPI
.students()
.addExternalRelation("studentId", "externalId", "relationType");
- 获取学生的外在关系
edusignAPI.students().getRelations("studentId");
- 删除学生的外部关系
edusignAPI.students().deleteRelation("studentId", "externalId");
学生变量
- 添加学生变量
edusignAPI.students().addVariable("studentId", "variable_name", "variable_value");
- 获取学生变量
edusignAPI.students().getVariables("studentId");
- 编辑学生变量
edusignAPI
.students()
.editVariable("studentId", "variableId", "variable_name", "variable_value");
- 删除学生变量
edusignAPI.students().deleteVariable("variableId");
调查
- 添加调查
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);
- 得到所有调查
edusignAPI.surveys().getAll();
- 由 Id 调查
edusignAPI.surveys().get("surveyId");
- 删除调查
edusignAPI.surveys().delete("surveyId");
- 发送提醒
edusignAPI.surveys().sendReminder("surveyId");
- 获取全部模板
edusignAPI.surveys().getAllTemplates();
- 从学生答案生成 PDF
edusignAPI.surveys().generatePDFFromStudentAnswers("surveyId", "studentId");
用户
- 添加用户
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);
- 获取所有用户
edusignAPI.users().getAll();
- 删除用户
edusignAPI.users().delete("userId");
- 更改用户权限
edusignAPI.users().changePermissions("userId", 3); // permissions: 0 | 1 | 2 | 3 | 4 | 5
用户
- 从 Adobe 文档获取输入
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
edusignAPI.utils().getInputsFromAdobeDocument(base64Data);
- 从文档文本获取输入
import fs from "fs";
const fileContent = fs.readFileSync("filePath");
const base64Data = Buffer.from(fileContent).toString("base64"); // output in string format
edusignAPI.utils().getInputsFromDocumentText(base64Data);
教室
- 添加课堂
edusignAPI.classrooms().add("classroom_add");
- 把所有的教室都搬来
edusignAPI.classrooms().getAll();
- 以姓名命名课堂
edusignAPI.classrooms().getByName("classroom_name");
- 更新教室
edusignAPI.classrooms().update("classroom_id", "classroom_name");
- 以 id 删除教室
edusignAPI.classrooms().delete("classroom_id");
- 按名称删除教室
edusignAPI.classrooms().deleteByName("classroom_name");
现状
- 设置学生缺席
edusignAPI
.presentialStates()
.setStudentAbsent("student_id", "course_id", "comment");
- 设置学生延迟
edusignAPI
.presentialStates()
.setStudentDelayed("student_id", "course_id", 30, "comment"); // 30 is delay in minutes
- 早点出发
edusignAPI
.presentialStates()
.setStudentEarlyDeparture("student_id", "course_id", "early_date", "comment");
- 设置学生评论
edusignAPI
.presentialStates()
.setStudentComment("student_id", "course_id", "comment");
- 设置排除学生
edusignAPI
.presentialStates()
.setStudentExcluded("student_id", "course_id", "excludeDate", "comment");
- 设置学生在场
edusignAPI.presentialStates().setStudentPresent("course_id", "student_id");
折旧
- 删除文档
edusignAPI.deprecated().deleteDocument("document_id");
- 获取全部文档
edusignAPI
.deprecated()
.getAllDocuments(
`optional : {studentId?: 'studentId', start?: 'startDate', end?: 'enddate'}`
);
- 由 ID 获取文档
edusignAPI.deprecated().getDocumentById("document_id");
- 获取全部文档模板
edusignAPI.deprecated().getAllDocumentTemplates();
- 发送模板以签名
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);
- 发送文档以签名
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);
- 没有模板就发送文档
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);
- 以 Id 为理由缺席
edusignAPI.deprecated().getJustifiedAbsenceById("absence_id");
维护者
这种回波由Edusign开发和维护.