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

GetXSchool() public method

Request single School by refId
public GetXSchool ( string refId ) : ResponseSingle
refId string
return ResponseSingle
        public ResponseSingle<XSchoolType> GetXSchool(string refId)
        {
            ResponseSingle<XSchoolType> output = new ResponseSingle<XSchoolType>();

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

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

            try
            {
                output.Data = response.Data.xSchool.First();
                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::GetXSchool ( string refId, int navigationPage, int navigationPageSize ) : ResponseSingle

Usage Example

        //RETURN SINGLE SCHOOL
        public static void XSchools_GetXSchool(XPress xPress)
        {
            if(xPress.GetXSchool(refId).Data != null)
            {
                XSchoolType school = xPress.GetXSchool(refId).Data;

                Console.WriteLine("refId: " + school.refId);
                Console.WriteLine("leaRefId: " + school.leaRefId);
                Console.WriteLine("localId: " + school.localId);
                Console.WriteLine("stateProvinceId: " + school.stateProvinceId);
                Console.WriteLine("##### BEGIN OTHERIDS #####");
                foreach (XOtherOrganizationIdType id in school.otherIds.otherId)
                {
                    Console.WriteLine("otherId id" + id.id);
                    Console.WriteLine("type: " + id.type);
                }
                Console.WriteLine("##### END OTHERIDS #####");
                Console.WriteLine("schoolName: " + school.schoolName);
                Console.WriteLine("##### BEGIN GRADELEVELS #####");
                foreach (String gl in school.gradeLevels.gradeLevel)
                {
                    Console.WriteLine("gradeLevel: " + gl);
                }
                Console.WriteLine("##### END GRADELEVELS #####");
                Console.WriteLine("##### BEGIN ADDRESS #####");
                Console.WriteLine("addressType: " + school.address.addressType);
                Console.WriteLine("city: " + school.address.city);
                Console.WriteLine("line1: " + school.address.line1);
                Console.WriteLine("line2: " + school.address.line2);
                Console.WriteLine("countryCode: " + school.address.countryCode);
                Console.WriteLine("postalCode: " + school.address.postalCode);
                Console.WriteLine("stateProvince: " + school.address.stateProvince);
                Console.WriteLine("##### END ADDRESS #####");
                Console.WriteLine("##### BEGIN PHONENUMBER #####");
                Console.WriteLine("number: " + school.phoneNumber.number);
                Console.WriteLine("phoneNumberType: " + school.phoneNumber.phoneNumberType);
                Console.WriteLine("primaryIndicator: " + school.phoneNumber.primaryIndicator);
                Console.WriteLine("##### END PHONENUMBER #####");
                Console.WriteLine("##### BEGIN OTHERPHONENUMBER #####");
                foreach (XTelephoneType p in school.otherPhoneNumbers.phoneNumber)
                {
                    Console.WriteLine("otherPhoneNumbers number: " + p.number);
                    Console.WriteLine("phoneNumberType: " + p.phoneNumberType);
                    Console.WriteLine("primaryIndicator: " + p.primaryIndicator);
                }
                Console.WriteLine("##### END OTHERPHONENUMBER #####");
                Console.WriteLine("========================================");
            }
        }