Portal

<back to all web services

AddSupplier

Requires Authentication
Requires any of the roles:VeoliaAdmin, SupplierRegistration
The following routes are available for this service:
POST/supplier
import Foundation
import ServiceStack

public class AddSupplier : SupplierBase, IPost
{
    public var mainActivities:[AddSupplierMainActivity] = []
    public var supplierAddresses:[AddSupplierSupplierAddress] = []

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

    private enum CodingKeys : String, CodingKey {
        case mainActivities
        case supplierAddresses
    }

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

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

public class SupplierBase : ModifyRequestBase
{
    public var vatNumber:String
    public var euTaxNumber:String
    public var groupTaxNumber:String
    public var businessType:Int
    public var countryId:Int
    public var name:String
    public var shortName:String
    public var registrationNumber:String
    public var establishedDate:Date
    public var registrationDate:Date
    public var duns:String
    public var operatingLicenseNumber:String
    public var isAccounting:Bool
    public var isSmallTaxPayer:Bool
    public var email:String
    public var phoneNumber:String
    public var website:String

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

    private enum CodingKeys : String, CodingKey {
        case vatNumber
        case euTaxNumber
        case groupTaxNumber
        case businessType
        case countryId
        case name
        case shortName
        case registrationNumber
        case establishedDate
        case registrationDate
        case duns
        case operatingLicenseNumber
        case isAccounting
        case isSmallTaxPayer
        case email
        case phoneNumber
        case website
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        vatNumber = try container.decodeIfPresent(String.self, forKey: .vatNumber)
        euTaxNumber = try container.decodeIfPresent(String.self, forKey: .euTaxNumber)
        groupTaxNumber = try container.decodeIfPresent(String.self, forKey: .groupTaxNumber)
        businessType = try container.decodeIfPresent(Int.self, forKey: .businessType)
        countryId = try container.decodeIfPresent(Int.self, forKey: .countryId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        shortName = try container.decodeIfPresent(String.self, forKey: .shortName)
        registrationNumber = try container.decodeIfPresent(String.self, forKey: .registrationNumber)
        establishedDate = try container.decodeIfPresent(Date.self, forKey: .establishedDate)
        registrationDate = try container.decodeIfPresent(Date.self, forKey: .registrationDate)
        duns = try container.decodeIfPresent(String.self, forKey: .duns)
        operatingLicenseNumber = try container.decodeIfPresent(String.self, forKey: .operatingLicenseNumber)
        isAccounting = try container.decodeIfPresent(Bool.self, forKey: .isAccounting)
        isSmallTaxPayer = try container.decodeIfPresent(Bool.self, forKey: .isSmallTaxPayer)
        email = try container.decodeIfPresent(String.self, forKey: .email)
        phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber)
        website = try container.decodeIfPresent(String.self, forKey: .website)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if vatNumber != nil { try container.encode(vatNumber, forKey: .vatNumber) }
        if euTaxNumber != nil { try container.encode(euTaxNumber, forKey: .euTaxNumber) }
        if groupTaxNumber != nil { try container.encode(groupTaxNumber, forKey: .groupTaxNumber) }
        if businessType != nil { try container.encode(businessType, forKey: .businessType) }
        if countryId != nil { try container.encode(countryId, forKey: .countryId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if shortName != nil { try container.encode(shortName, forKey: .shortName) }
        if registrationNumber != nil { try container.encode(registrationNumber, forKey: .registrationNumber) }
        if establishedDate != nil { try container.encode(establishedDate, forKey: .establishedDate) }
        if registrationDate != nil { try container.encode(registrationDate, forKey: .registrationDate) }
        if duns != nil { try container.encode(duns, forKey: .duns) }
        if operatingLicenseNumber != nil { try container.encode(operatingLicenseNumber, forKey: .operatingLicenseNumber) }
        if isAccounting != nil { try container.encode(isAccounting, forKey: .isAccounting) }
        if isSmallTaxPayer != nil { try container.encode(isSmallTaxPayer, forKey: .isSmallTaxPayer) }
        if email != nil { try container.encode(email, forKey: .email) }
        if phoneNumber != nil { try container.encode(phoneNumber, forKey: .phoneNumber) }
        if website != nil { try container.encode(website, forKey: .website) }
    }
}

public class ModifyRequestBase : IConcurrencyStamp, Codable
{
    public var concurrencyStamp:String

    required public init(){}
}

public class AddSupplierMainActivity : Codable
{
    public var teaor:String
    public var Description:String

    required public init(){}
}

public class AddSupplierSupplierAddress : Codable
{
    public var countryId:Int
    public var addressType:AddressType
    public var zipCode:String
    public var city:String
    public var address:String
    public var streetAddress:String
    public var streetType:String
    public var houseNumber:String
    public var building:String
    public var staircase:String
    public var floor:String
    public var door:String
    public var pob:String
    public var other:String

    required public init(){}
}

public enum AddressType : Int, Codable
{
    case Postal = 0
    case HeadQuarters = 1
    case Site = 2
}

public class ModifyEntityResponse : ResponseBase
{
    public var id:Int

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

    private enum CodingKeys : String, CodingKey {
        case id
    }

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

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

public class ResponseBase : Codable
{
    public var responseStatus:ResponseStatus

    required public init(){}
}


Swift AddSupplier DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /supplier HTTP/1.1 
Host: szallitoiportal-be.veolia.hu 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"MainActivities":[{"Teaor":"String","Description":"String"}],"SupplierAddresses":[{"CountryId":0,"AddressType":0,"ZipCode":"String","City":"String","Address":"String","StreetAddress":"String","StreetType":"String","HouseNumber":"String","Building":"String","Staircase":"String","Floor":"String","Door":"String","POB":"String","Other":"String"}],"VatNumber":"String","EUTaxNumber":"String","GroupTaxNumber":"String","BusinessType":0,"CountryId":0,"Name":"String","ShortName":"String","RegistrationNumber":"String","EstablishedDate":"0001-01-01T00:00:00.0000000","RegistrationDate":"0001-01-01T00:00:00.0000000","Duns":"String","OperatingLicenseNumber":"String","IsAccounting":false,"IsSmallTaxPayer":false,"Email":"String","PhoneNumber":"String","Website":"String","ConcurrencyStamp":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Id":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}