Collection Postman
The SYNC Process has as main objective to synchronize the information from academic systems with the HUB. At the time of the first sync, users, classes, disciplines will be created, as well as the institution's ensalement within the HUB. This process can be redone whenever there are new insertions, changes and deletions.
Request
-
PROD:
POST
https://apihub.educacional.com/prod/sync/v1
-
Has asynchronous data validation
-
Events must be sent in batch
-
Events must be sent in the JSON standard - if necessary, more than one call must be made to this endpoint
-
object must have the pattern:
-
Environments: prod, qa, etc.
header{
"x-api-key": /*APIKEY*/
}
- BODY
{
"doo": "2018/11/05T15:25:16.584Z", // date the event occurred (with the hours) (date of occurrence)
"ver": "1.0.0", // protocol version
"who": "sis.12458", // source of data
"org_id": "b253081c016x11eab2d30672699b542a", // Key representing an organization
"dat":[ // array with batch events
{/** event object */},
{/** event object */},
...
]
}
dat
: all events must be dispatched within the dat object- actions are sent separately (insert, update, delete) as standard below
{
"typ": "update", // event action identifier (insert, update and delete)
"obj": {
/* objects payload */
"user": [ //array of user objects
{/** user object */},
{/** user object */},
{/** user object */},
...
],
"section": [ // array of class objects
{/** section object */},
...
],
"subject": [
{/** subject object */},
...
],
"term": [
{/** subject object */},
...
],
"studentparent": [ // array of responsible student relationship objects
{/** studentparent object */},
...
],
"sectionstudent": [ // array of student relationship objects
{/** sectionstudent object */},
...
],
"sectionteacher": [ // array of class teacher relationship objects
{/** sectionteacher object */},
...
]
}
}
There are 3 main objects
user
: object with a user's data (regardless of role)section
: object with class datasubject
: object with the data of a subjectterm
: object with periods of the institution
And also the objects of links
studentparent
: object with the bond between a student and his guardiansectionstudent
: object with the bond between a student and his classsectionteacher
: object with the link between the teacher, the class and the discipline
Example
- 2 user to update
- 1 user, 1 class and 1 discipline and 2 relationships to insert
- 1 user to delete
{
"doo": "2018/11/05T15:25:16.584Z", // date the event occurred (with the hours) (date of occurrence)
"ver": "1.0.0", // protocol version
"who": "sis.12458", // source of data
"org_id": "b253081c016x11eab2d30672699b542a", // Key representing an organization
"dat":[ // array with batch events
{
"typ": "update", // event action identifier (insert, update and delete)
"obj": {
"user": [ // array of user objects
{/** user object */},
{/** user object */}
]
}
},
{
"typ": "insert", // event action identifier (insert, update and delete)
"obj": {
"user": [
{/** user object */}
],
"section": [
{/** sectionobject */}
],
"subject": [
{/** subjectobject */}
],
"sectionstudent": [
{/** sectionstudent object */}
],
"sectionteacher": [
{/** sectionteacher object */}
]
}
},
{
"typ": "delete", // event action identifier (insert, update and delete)
"obj": {
"user": [
"code": "125054", // Mandatory and unique field. User registration (RA)
"roles": [ // Required field. role that will be deleted (at least 1)
{
"code": "administrador",
"id": 9
},
{
"code": "professor",
"id": 2
}
]
]
}
}
]
}
- The payload of the objects is detailed on the pages of the objects (check the menu beside 👈)
Response
- Code: 200
- Status: OK
- Example:
{
"messageId": "df1656c6-bad8-4aa9-b405-e89e81892f09"
}
- Code: 400
- Status: Invalid Request
- Code: 500
- Status: Internal Error
Data Consultation
- The update process is done asynchronously, so the return with details about the synchronized data must be requested according to the data below
GET
URL: https://apihub.educacional.com/prod/instituicao/getLog/[messageId]
- Environments: prod, qa, etc.
header{
"x-api-key": /*APIKEY*/
}
BODY
- if not sent the default is:
- limit: 25
- offset: 0
{
"limit": 25, // number of records per page
"offset": 0 // index of the first object on the page
}
- payload structure follows the same format as the object sent in the POST
{
"qtdeRegistros": 6, // total records returned in the log
"status": 4, // general status of the log
"logs": [
{
"baseItem": {
"obj": "user",
"sis_id": "123123",
"mensagem": [{ // collection of messages
"dsc_error": "Perfil incluído com sucesso",
"level_Error": "w" // msg type (w=warning, i=info or e=error)
}]
}
},
{
"baseItem": {
"obj": "user",
"sis_id": "0",
"mensagem": [{
"dsc_error": "Login duplicado ou já cadastrado no HUB",
"level_Error": "e"
}]
}
},
{
"baseItem": {
"obj": "sectionstudent",
"sis_id": "4124123423",
"mensagem": [{
"dsc_error": "Vínculo cadastrado com sucesso",
"level_Error": "i"
}]
}
}
]
}
- status indication
Code | Meaning |
---|---|
1 | processing without errors |
2 | processing with errors |
3 | finished with errors |
4 | finished without errors |
HUB returns the object's unique identifier, but we always recommend using sys_id as a reference to objects sent