static void Main(string[] args) { Authenticator auth = new Authenticator(authUrl, clientId, clientSecret); //Pass auth url, username, and password to authenticate to auth server foreach (Endpoint e in auth.GetEndpoints(providerId)) //For the provided endpoint { XPress xPress = new XPress(e.href); //Pass endpoint info to data API (token, href) foreach (XLeaType l in xPress.GetXLeas().Data) //Iterate through each xLea { for (int i = 1; i <= xPress.GetLastPage(navigationPageSize, XPress.ServicePath.GetXRostersByXLea, l.refId); i++ ) //Get max page size for rosters by lea { foreach (XRosterType r in xPress.GetXRostersByXLea(l.refId, i, navigationPageSize).Data) //Get each roster for each lea refId w/ paging { Console.WriteLine("courseTitle: " + r.courseTitle); foreach (XPersonReferenceType p in r.students.studentReference) //Students for each course { Console.WriteLine("refId: " + p.refId); Console.WriteLine("localId: " + p.localId); Console.WriteLine("givenName: " + p.givenName); Console.WriteLine("familyName: " + p.familyName); } } Console.WriteLine("######## PAGE " + i + " ########"); } } } Console.Read(); }
//RETURN ROSTERS BY LEA public static void XRosters_GetXRostersByXLeaLastPage(XPress xPress) { for (int i = 1; i <= xPress.GetLastPage(navigationPageSize, XPress.ServicePath.GetXRostersByXLea, refId); i++) { foreach (XRosterType r in xPress.GetXRostersByXLea(refId, i, navigationPageSize).Data) { Console.WriteLine("refId: " + r.refId); Console.WriteLine("courseRefId: " + r.courseRefId); Console.WriteLine("courseTitle: " + r.courseTitle); Console.WriteLine("sectionRefId: " + r.sectionRefId); Console.WriteLine("subject: " + r.subject); Console.WriteLine("schoolRefId: " + r.schoolRefId); Console.WriteLine("schoolSectionId: " + r.schoolSectionId); Console.WriteLine("schoolYear: " + r.schoolYear); Console.WriteLine("sessionCode: " + r.sessionCode); Console.WriteLine("schoolCalendarRefId: " + r.schoolCalendarRefId); Console.WriteLine("##### BEGIN MEETING TIMES #####"); foreach (XMeetingTimeType mt in r.meetingTimes.meetingTime) { Console.WriteLine("timeTableDay: " + mt.timeTableDay); Console.WriteLine("bellScheduleDay: " + mt.classMeetingDays.bellScheduleDay); Console.WriteLine("timeTablePeriod: " + mt.timeTablePeriod); Console.WriteLine("roomNumber: " + mt.roomNumber); Console.WriteLine("classBeginningTime: " + mt.classBeginningTime); Console.WriteLine("classEndingTime: " + mt.classEndingTime); } Console.WriteLine("##### END MEETING TIMES #####"); Console.WriteLine("##### BEGIN STUDENTS #####"); foreach (XPersonReferenceType student in r.students.studentReference) { Console.WriteLine("refId: " + student.refId); Console.WriteLine("localId: " + student.localId); Console.WriteLine("givenName: " + student.givenName); Console.WriteLine("familyName: " + student.familyName); } Console.WriteLine("##### END STUDENTS #####"); Console.WriteLine("##### BEGIN PRIMARY STAFF #####"); Console.WriteLine("refId: " + r.primaryStaff.staffPersonReference.refId); Console.WriteLine("localId: " + r.primaryStaff.staffPersonReference.localId); Console.WriteLine("givenName: " + r.primaryStaff.staffPersonReference.givenName); Console.WriteLine("familyName: " + r.primaryStaff.staffPersonReference.familyName); Console.WriteLine("teacherOfRecord: " + r.primaryStaff.teacherOfRecord); Console.WriteLine("percentResponsible: " + r.primaryStaff.percentResponsible); Console.WriteLine("##### END PRIMARY STAFF #####"); Console.WriteLine("##### BEGIN OTHER STAFF #####"); foreach (XStaffReferenceType staff in r.otherStaffs.otherStaff) { Console.WriteLine("refId: " + staff.staffPersonReference.refId); Console.WriteLine("localId: " + staff.staffPersonReference.localId); Console.WriteLine("givenName: " + staff.staffPersonReference.givenName); Console.WriteLine("familyName: " + staff.staffPersonReference.familyName); Console.WriteLine("teacherOfRecord: " + staff.teacherOfRecord); Console.WriteLine("percentResponsible: " + staff.percentResponsible); } Console.WriteLine("##### END OTHER STAFF #####"); Console.WriteLine("========================================"); } Console.WriteLine("######## PAGE " + i + " ########"); } }