Portal

<back to all web services

BrowseAllApplicationUserCommodityCode

Requires Authentication
The following routes are available for this service:
GET/user/{userid}/commoditycode
import Foundation
import ServiceStack

public class BrowseAllApplicationUserCommodityCode : IGet, Codable
{
    public var userId:Int

    required public init(){}
}

public class BrowseAllApplicationUserCommodityCodeResponse : ResponseBase
{
    public var commodityCodes:[ApplicationUserCommodityCodeSimple] = []

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

    private enum CodingKeys : String, CodingKey {
        case commodityCodes
    }

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

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

public class ResponseBase : Codable
{
    public var responseStatus:ResponseStatus

    required public init(){}
}

public class ApplicationUserCommodityCodeSimple : CommodityCodeSimple
{
    public var commodityCodeId:Int
    public var userCommodityCodeId:Int

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

    private enum CodingKeys : String, CodingKey {
        case commodityCodeId
        case userCommodityCodeId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        commodityCodeId = try container.decodeIfPresent(Int.self, forKey: .commodityCodeId)
        userCommodityCodeId = try container.decodeIfPresent(Int.self, forKey: .userCommodityCodeId)
    }

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

public class CommodityCodeSimple : Codable
{
    public var id:Int
    public var categoryCode:String
    public var categoryName:String
    public var subCategoryCode:String
    public var subCategoryName:String
    public var mainCategoryCode:String
    public var mainCategoryName:String

    required public init(){}
}


Swift BrowseAllApplicationUserCommodityCode DTOs

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

HTTP + CSV

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

GET /user/{userid}/commoditycode HTTP/1.1 
Host: szallitoiportal-be.veolia.hu 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"CommodityCodes":[{"CommodityCodeId":0,"UserCommodityCodeId":0,"Id":0,"CategoryCode":"String","CategoryName":"String","SubCategoryCode":"String","SubCategoryName":"String","MainCategoryCode":"String","MainCategoryName":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}