Skip to content

Open Saber API Examples

sknirmalkar89 edited this page Mar 8, 2021 · 9 revisions

OpenSABER API Examples

Scenario 1: Adding a book in the registry

POST - <BASE_URL>/add

Request Body

{
  "id": "open-saber.registry.create",
  "ver": "1.0",
  "ets": "11234",
  "params": {
    "did": "",
    "key": "",
    "msgid": ""
  },
  "request": {
    "Teacher": {
      "signatures": [
        {
          "@type": "sc:GraphSignature2012",
          "signatureFor": "http://localhost:8080/serialNum",
          "creator": "https://example.com/i/pat/keys/5",
          "created": "2017-09-23T20:21:34.000Z",
          "nonce": "2bbgh3dgjg2302d-d2b3gi423d42",
          "signatureValue": "eyiOiJKJ0eXA...OEjgFWFXk"
        }
      ],
      "serialNum": 102,
      "teacherCode": "12223hjjj4d",
      "nationalIdentifier": "12345678jj90123456",
      "teacherName": "Marvin Pande",
      "gender": "GenderTypeCode-MALE",
      "birthDate": "1990-12-06T00:00:00.000Z",
      "socialCategory": "SocialCategoryTypeCode-GENERAL",
      "highestAcademicQualification": "AcademicQualificationTypeCode-PHD",
      "highestTeacherQualification": "TeacherQualificationTypeCode-MED",
      "yearOfJoiningService": "2014",
      "teachingRole": {
        "@type": "TeachingRole",
        "teacherType": "TeacherTypeCode-HEAD",
        "appointmentType": "TeacherAppointmentTypeCode-REGULAR",
        "classesTaught": "ClassTypeCode-SECONDARYANDHIGHERSECONDARY",
        "appointedForSubjects": "SubjectCode-ENGLISH",
        "mainSubjectsTaught": [
          "SubjectCode-SOCIALSTUDIES",
          "SubjectCode-ENGLISH"
        ],
        "appointmentYear": "2015"
      },
      "inServiceTeacherTrainingFromBRC": {
        "daysOfInServiceTeacherTraining": "10"
      },
      "inServiceTeacherTrainingFromCRC": {
        "daysOfInServiceTeacherTraining": "2"
      },
      "inServiceTeacherTrainingFromDIET": {
        "daysOfInServiceTeacherTraining": "5.5"
      },
      "inServiceTeacherTrainingFromOthers": {
        "@type": "InServiceTeacherTrainingFromOthers",
        "daysOfInServiceTeacherTraining": "3.5"
      },
      "nonTeachingAssignmentsForAcademicCalendar": {
        "@type": "NonTeachingAssignmentsForAcademicCalendar",
        "daysOfNonTeachingAssignments": 6
      },
      "basicProficiencyLevel": [
        {
          "@type": "BasicProficiencyLevel",
          "proficiencySubject": "SubjectCode-MATH",
          "proficiencyAcademicQualification": "AcademicQualificationTypeCode-PHD"
        },
        {
          "@type": "BasicProficiencyLevel",
          "proficiencySubject": "SubjectCode-ENGLISH",
          "proficiencyAcademicQualification": "AcademicQualificationTypeCode-HIGHERSECONDARY"
        },
        {
          "@type": "BasicProficiencyLevel",
          "proficiencySubject": "SubjectCode-SOCIALSTUDIES",
          "proficiencyAcademicQualification": "AcademicQualificationTypeCode-SECONDARY"
        }
      ],
      "disabilityType": "DisabilityCode-NA",
      "trainedForChildrenSpecialNeeds": "YesNoCode-YES",
      "trainedinUseOfComputer": "YesNoCode-YES"
    }
  }
}

Scenario 2: Reading a Teacher from the registry

GET - <BASE_URL>/read(ID of the Teacher)

Request Body

{
  "id": "open-saber.registry.read",
  "ver": "1.0",
  "ets": "11234",
  "params": {
    "did": "",
    "key": "",
    "msgid": ""
  },
  "request": {
      "Teacher": {
            "osid": "1-5addf222-baa0-4903-9974-dc38de76f4c0"
        }
    }
     
}

Scenario 3: Updating Teacher's role subject

POST - <BASE_URL>/update

Request Body


{
  "id": "open-saber.registry.update",
  "ver": "1.0",
  "ets": "11234",
  "params": {
    "did": "",
    "key": "",
    "msgid": ""
  },
  "request": {
    "Teacher": {
      "osid": "1-5addf222-baa0-4903-9974-dc38de76f4c0",
      "teachingRole":{
           "osid":"1-1d731b73-0334-4e0d-ba98-78bbf6b5e108",
           "mainSubjectsTaught": ["SubjectCode-SOCIALSTUDIES","SubjectCode-LANGUAGE"]
          }   
    }
  }
}

Scenario 4: Updating the teachers year of joining service.

POST - <BASE_URL>/update

Request Body


{
  "id": "open-saber.registry.update",
  "ver": "1.0",
  "ets": "11234",
  "params": {
    "did": "",
    "key": "",
    "msgid": ""
  },
  "request": {
    "Teacher": {
      "osid": "1-5addf222-baa0-4903-9974-dc38de76f4c0",
      "yearOfJoiningService":"2019" 
    }
  }
}

Scenario 5: Delete a teacher from the registry

DELETE - <BASE_URL>/delete(ID of the Teacher)

Reuqest Body

{
  "id": "open-saber.registry.delete",
  "ver": "1.0",
  "ets": "11234",
  "params": {
    "did": "",
    "key": "",
    "msgid": ""
  },
  "request": {
      "Teacher":{
          "osid": "1-5addf222-baa0-4903-9974-dc38de76f4c0"
      }
     
  }
}