AIM Web Services

<back to all web services

InventoryQtyRequest

InventoryQty
Requires active-e Inventory Service or active-e Vortx E-Commerce or active-e 3rd Party E-Commerce

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

/**
* InventoryQtyRequires active-e Inventory Service or active-e Vortx E-Commerce or active-e 3rd Party E-Commerce
*/
// @DataContract
public class InventoryQtyRequest : BaseRequest
{
    // @DataMember
    public var pk:Int?

    // @DataMember
    public var model:String

    // @DataMember
    public var aeId:String

    // @DataMember
    public var skuPk:Int?

    // @DataMember
    public var sku:String

    // @DataMember
    public var sendVendorQtyAsSeperateLocation:Bool

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

    private enum CodingKeys : String, CodingKey {
        case pk
        case model
        case aeId
        case skuPk
        case sku
        case sendVendorQtyAsSeperateLocation
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        pk = try container.decodeIfPresent(Int.self, forKey: .pk)
        model = try container.decodeIfPresent(String.self, forKey: .model)
        aeId = try container.decodeIfPresent(String.self, forKey: .aeId)
        skuPk = try container.decodeIfPresent(Int.self, forKey: .skuPk)
        sku = try container.decodeIfPresent(String.self, forKey: .sku)
        sendVendorQtyAsSeperateLocation = try container.decodeIfPresent(Bool.self, forKey: .sendVendorQtyAsSeperateLocation)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if pk != nil { try container.encode(pk, forKey: .pk) }
        if model != nil { try container.encode(model, forKey: .model) }
        if aeId != nil { try container.encode(aeId, forKey: .aeId) }
        if skuPk != nil { try container.encode(skuPk, forKey: .skuPk) }
        if sku != nil { try container.encode(sku, forKey: .sku) }
        if sendVendorQtyAsSeperateLocation != nil { try container.encode(sendVendorQtyAsSeperateLocation, forKey: .sendVendorQtyAsSeperateLocation) }
    }
}

// @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 InventoryQtyResponse : BaseResponse
{
    // @DataMember
    public var variants:[InventoryQtyByVariant] = []

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

    private enum CodingKeys : String, CodingKey {
        case variants
    }

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

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

// @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 InventoryQtyByVariant : Codable
{
    // @DataMember
    public var sku:String

    // @DataMember
    public var aeVariantName:String

    // @DataMember
    public var locations:[InventoryQtyByLocation] = []

    required public init(){}
}

// @DataContract
public class InventoryQtyByLocation : Codable
{
    // @DataMember
    public var locationInfo:LocationInfo

    // @DataMember
    public var qtyAvail:Double

    required public init(){}
}

// @DataContract
public class LocationInfo : Codable
{
    // @DataMember
    public var id:Int

    // @DataMember
    public var desc:String

    // @DataMember
    public var shortDesc:String

    // @DataMember
    public var region:String

    // @DataMember
    public var latitude:Double

    // @DataMember
    public var longitude:Double

    // @DataMember
    public var inStorePickup:String

    // @DataMember
    public var active:Bool

    // @DataMember
    public var cashSaleAcct:Int?

    required public init(){}
}


Swift InventoryQtyRequest DTOs

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

HTTP + XML

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

POST /api/InventoryQty HTTP/1.1 
Host: active-ewebservice.biz 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<InventoryQtyRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
  <ApiKey>String</ApiKey>
  <OAuthToken>String</OAuthToken>
  <AeId>String</AeId>
  <Model>String</Model>
  <Pk>0</Pk>
  <SendVendorQtyAsSeperateLocation>false</SendVendorQtyAsSeperateLocation>
  <Sku>String</Sku>
  <SkuPk>0</SkuPk>
</InventoryQtyRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<InventoryQtyResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
  <Status>
    <DomainName>String</DomainName>
    <ErrorCode>String</ErrorCode>
    <ErrorDisplayText>String</ErrorDisplayText>
    <ErrorMessage>String</ErrorMessage>
    <IpAddress>String</IpAddress>
    <Login>String</Login>
    <StatusCode>String</StatusCode>
  </Status>
  <Variants>
    <InventoryQtyResponse.InventoryQtyByVariant i:nil="true" />
  </Variants>
</InventoryQtyResponse>