Registration Forms

1. How do you query the registrations forms?

<?php
$academicYear = \Arbor\Model\AcademicYear::retrieve('2014-2015');

$query = new \Arbor\Query\Query(\Arbor\Resource\ResourceType::REGISTRATION_FORM);
$query->addPropertyFilter(\Arbor\Model\RegistrationForm::ACADEMIC_YEAR, \Arbor\Query\Query::OPERATOR_EQUALS, $academicYear);

$registrationForms = \Arbor\Model\RegistrationForm::query($query);

2. How do you add a registration form?

<?php
$registrationForm = new \Arbor\Model\RegistrationForm();
$registrationForm->setAcademicYear($academicYear);
$registrationForm->setRegistrationFormName('Form 9A');
$registrationForm->setShortName('9A');
$registrationForm->setDisplayOrder(10);
$registrationForm->save();

3. How do you then query who is in a registration form?

<?php
$query = new \Arbor\Query\Query(\Arbor\Resource\ResourceType::REGISTRATION_FORM_MEMBERSHIP);
$query->addPropertyFilter(\Arbor\Model\RegistrationFormMembership::REGISTRATION_FORM, \Arbor\Query\Query::OPERATOR_EQUALS, $registrationForm);

$registrationFormMemberships = \Arbor\Model\RegistrationFormMembership::query($query);
foreach ($registrationFormMemberships as $registrationFormMembership) {
    echo $registrationFormMembership->getStudent()->getResourceId();
}

4. How do you add people to a registration form

a. Ensure they have a School Enrolment first in that academic year. This is a pre-requisite.
<?php
$schoolEnrolment = new \Arbor\Model\SchoolEnrolment();
$schoolEnrolment->setStudent($student);
$schoolEnrolment->setAcademicYear($academicYear);
$schoolEnrolment->save();
b. Create registration form membership for that student....
<?php
$registrationFormMembership = new \Arbor\Model\RegistrationFormMembership();
$registrationFormMembership->setRegistrationForm($registrationForm);
$registrationFormMembership->setStudent($student);
$registrationFormMembership->save();

Courses/Modules

5. How do you query the list of courses?

<?php
$academicYear = \Arbor\Model\AcademicYear::retrieve('2014-2015');

$query = new \Arbor\Query\Query(\Arbor\Resource\ResourceType::ACADEMIC_UNIT);
$query->addPropertyFilter(\Arbor\Model\AcademicUnit::ACADEMIC_YEAR, \Arbor\Query\Query::OPERATOR_EQUALS, $academicYear);

$academicUnits = \Arbor\Model\AcademicUnit::query($query);

6. How do you add a course?

<?php
$parentAcademicUnit  = new \Arbor\Model\AcademicUnit();
$parentAcademicUnit ->setAcademicYear($academicYear);
$parentAcademicUnit ->setAcademicUnitName('Form 9A');
$parentAcademicUnit ->setShortName('9A');
$parentAcademicUnit ->setDisplayOrder(10);
$parentAcademicUnit ->save();

7. How do you add a module to a course (or modules to modules - same process)?

<?php
$academicUnit = new \Arbor\Model\AcademicUnit();
$academicUnit->setAcademicYear($academicYear);
$academicUnit->setParentAcademicUnit($parentAcademicUnit);
$academicUnit->setAcademicUnitName('Form 9A');
$academicUnit->setShortName('9A');
$academicUnit->setDisplayOrder(10);
$academicUnit->save();

8. How do you query who is enrolled in the course/module?

<?php
$query = new \Arbor\Query\Query(\Arbor\Resource\ResourceType::ACADEMIC_UNIT_ENROLMENT);
$query->addPropertyFilter(\Arbor\Model\AcademicUnitEnrolment::ACADEMIC_UNIT, \Arbor\Query\Query::OPERATOR_EQUALS, $academicUnit);

$academicUnitEnrolments = \Arbor\Model\AcademicUnitEnrolment::query($query);
foreach ($academicUnitEnrolments as $academicUnitEnrolment) {
    echo $academicUnitEnrolment->getStudent()->getResourceId();
}

9. How do you enrol people in the module?

a. Pre-requisite - student must have a school enrolment for that academic year
<?php
$schoolEnrolment = new \Arbor\Model\SchoolEnrolment();
$schoolEnrolment->setStudent($student);
$schoolEnrolment->setAcademicYear($academicYear);
$schoolEnrolment->save();
b. Create academic unit enrolment
<?php
$academicUnitEnrolment = new \Arbor\Model\AcademicUnitEnrolment();
$academicUnitEnrolment->setAcademicUnit($academicUnit);
$academicUnitEnrolment->setStudent($student);
$academicUnitEnrolment->save();

10. How do I retrieve a list of year groups?

Year groups in Arbor are called AcademicLevels. You can query the AcademicLevel resource for a full list and you can retrieve students by querying the AcademicLevelMembeship resource using filters for student, startDate and endDate.

11. How do I get the postal address for a student?

Query the PostalAddressOccupancy resource using filters so that it only returns records which WHERE
a. The current date is between the startDate and endDate
b. The occupant is the student in question

The resulting resource will include a property called postalAddress which is an address record.

12. How do I get more info about the school?

You can access the EducationalInstitution resource. The school which you are connected to will always have ID=1 so you can access these details at:
http://school-host-name/rest-v2/educational-institution/1

Example output:

<response>
    <educationalInstitution>
        <entityType>EducationalInstitution</entityType>
        <href>/rest-v2/educational-institutions/1</href>
        <educationalInstitutionName>Sunnyville School</educationalInstitutionName>
        <shortName/>
        <openingDate>2011-09-01 00:00:00</openingDate>
        <closingDate/>
        <revisionId>1208877</revisionId>
        <userTags/>
        <schoolGender>C</schoolGender>
        <schoolPhase/>
        <schoolType/>
        <governanceType/>
        <intakeType/>
        <localAuthority/>
        <establishmentNumber>2000</establishmentNumber>
        <urn>100000</urn>
    </educationalInstitution>
</response>

13. How do I get the current and past UPN-s for a student?

Please refer to the UpnAssignment resource. It contains a startDate, endDate and student properties. Please use the filters to match only the records relevant to the student and time coordinate you are interested in.

14. How do I find siblings of a student?

Currently we don't store this information explicitly but you can derive it by querying the StudentGuardianRelationship records for a specific guardianRelationshipType that you are interested in. For example you can get a list of students who have a common legalGuardian.

15. How do I find gifted and talented students?

Please query the StudentGift and StudentTalent resources respectively. To figure out what goes under Talents please list all Talent resources.

16. How do list programme instances?

Programme instances are specific programmes being tought during a period of time. The same programme for example may have two instances one for 2013 and one for 2014. To get a list of programme instances for a specific programme please access the ProgrammeInstance listing and filter by the specific Programme object that you are interested in.

17. How do I list the students which are enrolled on a specific ProgrammeInstance?

Once you have the specific ProgrammeInstance object that you are interested in you can query the ProgrammeEnrolment resource and filter the results by the programmeInstance property. The resulting enrolment records will each contain a student property.

18. How do I found out which BusinessRoles a person has assigned to them?

Each staff object has a person property. You can query the BusinessRoleAssignment resource filtering by Person startDate and endDate.

19. How to retrieve current staff or current teaching staff?

Groups are defined using taggings. Teaching staff are all Staff objects which are tagged with: STAFF__CURRENT_TEACHING_STAFF You can query the Staff resource and filter the results by tag via the tagged operator:.

/rest-v2/staff?filters.self.tagged=STAFF__CURRENT_TEACHING_STAFF

If using the SDK you can construct the following query:

RestGateway gateway = new RestGateway(URL, USERNAME, PASSWORD, USER_AGENT);

SimpleQuery query = new SimpleQuery(ResourceType.STAFF);
List<object> taggings = new List<object>();
taggings.Add("STAFF__CURRENT_TEACHING_STAFF");

query.setTaggings(taggings);
ModelCollection<ModelBase> collection = gateway.query(query);

Hydrator hydrator = new Hydrator();
foreach (Staff model in collection) {
    Console.WriteLine ( hydrator.extractArray(model) + "\n");
}

20. How do I read attendance marks?

The AttendanceMark resource is an enumeration of possible attendance outcomes like Late, Present and Abstent etc. The resource AttendanceRecord is the actual record of which mark was awarded to which student and when.

You can use the AttendanceRecord resource and filter the results by Student and starDatetime and endDatetime.

21. How do I write attendance marks using the .NET SDK?

Writing attendance marks is a little bit more complicated which is why we created a convenience API for this. If you are using the .NET SDK please refer to the examples folder and in particular the writeAttendanceMarks() method which I have included below in full.

RestGateway gateway = new RestGateway(URL, USERNAME, PASSWORD, USER_AGENT);
AttendanceRegistration attendanceService = new AttendanceRegistration(gateway);
ModelBase.setDefaultGateway(gateway);

// Set session start time to today 9AM
DateTime sessionStartTime = DateTime.Now;

// Get some students which we are going to mark
Student student12 = Student.retrieve("12");
Student student13 = Student.retrieve("13");
Student student14 = Student.retrieve("1090");

// Get some valid attendance marks
AttendanceMark attMarkPresent = AttendanceMark.retrieve("PRESENT");
AttendanceMark attMarkLate = AttendanceMark.retrieve("LATE");

// Assign marks to students
attendanceService.awardAttendanceMark(student12, sessionStartTime, attMarkPresent);
attendanceService.awardAttendanceMark(student13, sessionStartTime, attMarkPresent);
attendanceService.awardAttendanceMark(student14, sessionStartTime, attMarkLate, 16, "Says he missed the bus");

// Write marks to the server
attendanceService.saveMarks();

22. Changelog

In addition to List, Create, Read, Update & Delete we now have an additional API method called Changelog. This method is available on all resource types which support revisionIds. By accessing the Changelog method you can retrieve a list of all changes needed to bring your local data from revision A to revision B. The Changelog method is accessed by sending a GET request to the resource listing URL with the word changelog appended. This will work for all resources which support revisionIds.



Here is an example:


http://your-school.uk.arbor.sc/rest-v2/staff/changelog

http://your-school.uk.arbor.sc/rest-v2/guardians/changelog?from-revision=89607

http://your-school.uk.arbor.sc/rest-v2/students/changelog?from-revision=89607


The last one will give you:


<response>
    <status>OK</status>
    <success>true</success>
    <code>200</code>
    <changes>
        <change>
            <changedObject>
                <entityType>Student</entityType>
                <href>/rest-v2/students/802</href>
            </changedObject>
            <fromRevision>89607</fromRevision>
            <toRevision>5781575</toRevision>
            <changeType>update</changeType>
        </change>
        <change>
            <changedObject>
                <entityType>Student</entityType>
                <href>/rest-v2/students/811</href>
            </changedObject>
            <fromRevision>89607</fromRevision>
            <toRevision>3331737</toRevision>
            <changeType>update</changeType>
        </change>
        <change>
            <changedObject>
                <entityType>Student</entityType>
                <href>/rest-v2/students/814</href>
            </changedObject>
            <fromRevision>89607</fromRevision>
            <toRevision>3974862</toRevision>
            <changeType>delete</changeType>
        </change>
    
</changes>

</response>

Please note that the changelog does not detail every single change that happened between revisions A and B. It only shows you what you need to do to bring your data-set up to the latest revision. Lets say that you last updated your data to revision 10. Then suppose that someone created a new student in revision 15 and then updated that same student in revision 16. If you subsequently request a changelog from revision 10 to revision 16 you will see a single change telling you that you need to create a new student with a URI pointing you to the student resource as it exists in the latest (current) version.

23. Can I install the PHP SDK using composer.json?

Yes. To install the PHP SDK using composer.json, please go to our SDK page and on the sidebar menu choose PHP SDK. You will be directed to our download PHP SDK page or simply click here.

24. How do I check which version of the .NET SDK I am using in my project?

The SDK version is part of the metadata in the ArborSDK.dll. You can access it by clicking the ArborSDK reference in your project view:

[assembly: AssemblyVersion ("0.1.1.39725")]
[assembly: AssemblyCompany ("Arbor Education")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCopyright ("Arbor Education")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyProduct ("Arbor SDK DOT NET")]
[assembly: AssemblyTitle ("ArborSdk")]
[assembly: AssemblyTrademark ("")]
[assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]