tvpl.api

<back to all web services

CreateCategoryRequest

Requires Authentication
Required role:super-admin
The following routes are available for this service:
POST/category/create
import Foundation
import ServiceStack

public class CreateCategoryRequest : CreateCategoryModel
{
    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 CreateCategoryModel : Codable
{
    public var name:String
    public var Description:String
    public var type:CategoryTypes
    public var isParty:Bool
    // @Ignore()
    public var childList:[Int] = []

    required public init(){}
}

public enum CategoryTypes : String, Codable
{
    case Department
    case PartyGroup
    case DocGroup
    case DocType
    case IssuingAgency
    case Status
    case Subjects
    case Workflow
}

public class CreateCategoryResponse : IResponseRequest, Codable
{
    public var id:Int
    public var code:Int
    public var message:String

    required public init(){}
}


Swift CreateCategoryRequest 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 /category/create HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"name":"String","description":"String","type":"Department","isParty":false,"childList":[0]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"id":0,"code":0,"message":"String"}