Portal

<back to all web services

AddPurchaseOrder

Requires Authentication
Required role:VeoliaAdmin
The following routes are available for this service:
POST/user/{supplieruserid}/purchaseorder
import Foundation
import ServiceStack

public class AddPurchaseOrder : ModifyPurchaseOrderBase, IPost
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class ModifyPurchaseOrderBase : ModifyRequestBase
{
    public var purchaseOrderIdentifier:String
    public var tenderUserId:Int?
    public var supplierUserId:Int
    public var buyer:String
    public var subject:String
    public var confirmationDeadline:Date

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

    private enum CodingKeys : String, CodingKey {
        case purchaseOrderIdentifier
        case tenderUserId
        case supplierUserId
        case buyer
        case subject
        case confirmationDeadline
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        purchaseOrderIdentifier = try container.decodeIfPresent(String.self, forKey: .purchaseOrderIdentifier)
        tenderUserId = try container.decodeIfPresent(Int.self, forKey: .tenderUserId)
        supplierUserId = try container.decodeIfPresent(Int.self, forKey: .supplierUserId)
        buyer = try container.decodeIfPresent(String.self, forKey: .buyer)
        subject = try container.decodeIfPresent(String.self, forKey: .subject)
        confirmationDeadline = try container.decodeIfPresent(Date.self, forKey: .confirmationDeadline)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if purchaseOrderIdentifier != nil { try container.encode(purchaseOrderIdentifier, forKey: .purchaseOrderIdentifier) }
        if tenderUserId != nil { try container.encode(tenderUserId, forKey: .tenderUserId) }
        if supplierUserId != nil { try container.encode(supplierUserId, forKey: .supplierUserId) }
        if buyer != nil { try container.encode(buyer, forKey: .buyer) }
        if subject != nil { try container.encode(subject, forKey: .subject) }
        if confirmationDeadline != nil { try container.encode(confirmationDeadline, forKey: .confirmationDeadline) }
    }
}

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

    required public init(){}
}

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 AddPurchaseOrder DTOs

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

HTTP + JSV

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

POST /user/{supplieruserid}/purchaseorder HTTP/1.1 
Host: szallitoiportal-be.veolia.hu 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	PurchaseOrderIdentifier: String,
	TenderUserId: 0,
	SupplierUserId: 0,
	Buyer: String,
	Subject: String,
	ConfirmationDeadline: 0001-01-01,
	ConcurrencyStamp: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
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
		}
	}
}