AIM Web Services

<back to all web services

C2BGetSchoolInfoRequest

C2BGetSchoolInfo
Requires active-e Contracts Service.

The following routes are available for this service:
POST, GET/api/C2BGetSchoolInfo
import Foundation
import ServiceStack

/**
* C2BGetSchoolInfoRequires active-e Contracts Service.
*/
// @DataContract
public class C2BGetSchoolInfoRequest : BaseRequest
{
    /**
    * If sent, only schools associated with the sent plan code will be returned.
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="If sent, only schools associated with the sent plan code will be returned.", Name="PlanCode", ParameterType="query")
    public var planCode:String

    /**
    * If sent, only schools associated with the sent district will be returned.
    */
    // @DataMember
    // @ApiMember(DataType="integer", Description="If sent, only schools associated with the sent district will be returned.", Format="int64", Name="DistrictId", ParameterType="query")
    public var districtId:Int?

    /**
    * ID of the Instrument record. Optional.
    */
    // @DataMember
    // @ApiMember(DataType="integer", Description="ID of the Instrument record. Optional.", Format="int64", Name="RinPk", ParameterType="query")
    public var rinPk:Int?

    /**
    * Optional Request Type. Valid values are Contract and Shipping.
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="Optional Request Type. Valid values are Contract and Shipping.", Name="RequestType", ParameterType="query")
    public var requestType:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case planCode
        case districtId
        case rinPk
        case requestType
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        planCode = try container.decodeIfPresent(String.self, forKey: .planCode)
        districtId = try container.decodeIfPresent(Int.self, forKey: .districtId)
        rinPk = try container.decodeIfPresent(Int.self, forKey: .rinPk)
        requestType = try container.decodeIfPresent(String.self, forKey: .requestType)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if planCode != nil { try container.encode(planCode, forKey: .planCode) }
        if districtId != nil { try container.encode(districtId, forKey: .districtId) }
        if rinPk != nil { try container.encode(rinPk, forKey: .rinPk) }
        if requestType != nil { try container.encode(requestType, forKey: .requestType) }
    }
}

// @DataContract
public class BaseRequest : Codable
{
    /**
    * This is your AIM API Key provided by Tri-Tech
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
    public var apiKey:String

    // @DataMember
    // @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
    public var oAuthToken:String

    required public init(){}
}

// @DataContract
public class C2BGetSchoolInfoResponse : BaseResponse
{
    // @DataMember
    public var schools:[C2BSchoolGeneric] = []

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case schools
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        schools = try container.decodeIfPresent([C2BSchoolGeneric].self, forKey: .schools) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if schools.count > 0 { try container.encode(schools, forKey: .schools) }
    }
}

// @DataContract
public class BaseResponse : Codable
{
    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
    public var status:BaseResponseResult

    required public init(){}
}

// @DataContract
public class BaseResponseResult : Codable
{
    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
    public var statusCode:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
    public var login:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
    public var errorCode:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
    public var errorDisplayText:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
    public var errorMessage:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
    public var domainName:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
    public var ipAddress:String

    required public init(){}
}

// @DataContract
public class C2BSchoolGeneric : Codable
{
    // @DataMember
    public var schoolName:String

    // @DataMember
    public var districtName:String

    // @DataMember
    public var teacherCount:Int

    // @DataMember
    public var topic:String

    // @DataMember
    public var id:Int

    // @DataMember
    public var deliveryInfo:C2BDeliveryInfo

    // @DataMember
    public var aimSchoolId:Int?

    required public init(){}
}

// @DataContract
public class C2BDeliveryInfo : Codable
{
    // @DataMember
    public var firstDelivery:Date

    // @DataMember
    public var deliveryTime:Date

    // @DataMember
    public var deliveryThreshold:Int

    // @DataMember
    public var sundayDelivery:Bool

    // @DataMember
    public var mondayDelivery:Bool

    // @DataMember
    public var tuesdayDelivery:Bool

    // @DataMember
    public var wednesdayDelivery:Bool

    // @DataMember
    public var thursdayDelivery:Bool

    // @DataMember
    public var fridayDelivery:Bool

    // @DataMember
    public var saturdayDelivery:Bool

    required public init(){}
}


Swift C2BGetSchoolInfoRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/C2BGetSchoolInfo HTTP/1.1 
Host: active-ewebservice.biz 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"PlanCode":"String","DistrictId":0,"RinPk":0,"RequestType":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Schools":[{}],"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}