예제 #1
0
        static void Main(string[] args)
        {
            Authenticator auth = Authenticator.Instance;

            auth.Authenticate(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(ServicePath.GetXRostersByXLea, l.refId, navigationPageSize); 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();
        }