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

GetXLeas() public method

Request all Leas
public GetXLeas ( ) : ResponseMulti
return ResponseMulti
        public ResponseMulti<XLeaType> GetXLeas()
        {
            ResponseMulti<XLeaType> output = new ResponseMulti<XLeaType>();

            RestRequest request = new RestRequest("xLeas", Method.GET);
            request.AddHeader("Accept", "application/json");

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

            try
            {
                output.Data = response.Data.xLeas.xLea;
                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::GetXLeas ( 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::GetXLeas