RicOneApi.Api.XPress.GetXRostersByXLea C# (CSharp) Method

GetXRostersByXLea() public method

Returns Rosters associated to a specific Lea by refId
public GetXRostersByXLea ( string refId ) : ResponseMulti
refId string
return ResponseMulti
        public ResponseMulti<XRosterType> GetXRostersByXLea(string refId)
        {
            ResponseMulti<XRosterType> output = new ResponseMulti<XRosterType>();

            RestRequest request = new RestRequest("xLeas/{refId}/xRosters", Method.GET);
            request.AddParameter("refId", refId, ParameterType.UrlSegment);
            request.AddHeader("Accept", "application/json");

            var response = restClient.Execute<XRosterCollectionType>(request);

            try
            {
                output.Data = response.Data.xRosters.xRoster;
                output.StatusCode = (int)response.StatusCode;
                output.Message = response.StatusDescription;
                output.Header = Util.BuildHeader(response);
            }
            catch (Exception)
            {
                output.Data = null;
                output.StatusCode = (int)response.StatusCode;
                output.Message = response.StatusDescription;
                output.Header = Util.BuildHeader(response);
            }

            return output;
        }

Same methods

XPress::GetXRostersByXLea ( string refId, int navigationPage, int navigationPageSize ) : ResponseMulti

Usage Example

        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();
        }
All Usage Examples Of RicOneApi.Api.XPress::GetXRostersByXLea