| Requires any of the roles: | Worker, Agent, Administrator, Administrator, Administrator, Administrator |
| GET,POST,PUT,OPTIONS | /v1/Department | ||
|---|---|---|---|
| GET,DELETE,OPTIONS | /v1/Department/{DepartmentID} |
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Department:
department_i_d: int = 0
department_u_i_d: Optional[str] = None
name: Optional[str] = None
description: Optional[str] = None
code: Optional[str] = None
color: Optional[str] = None
budget: Decimal = decimal.Decimal(0)
billing_method: Optional[str] = None
cost_center: Optional[str] = None
billing_contact: Optional[str] = None
billing_email: Optional[str] = None
approval_on: bool = False
threshold: Decimal = decimal.Decimal(0)
active: bool = False
created_by: Optional[str] = None
created_at: datetime.datetime = datetime.datetime(1, 1, 1)
members: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DepartmentResponse:
response_status: Optional[ResponseStatus] = None
department: List[Department] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DepartmentRequest:
department_i_d: int = 0
department: Optional[Department] = None
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/Department HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
DepartmentID: 0,
Department:
{
DepartmentID: 0,
DepartmentUID: 00000000000000000000000000000000,
Name: String,
Description: String,
Code: String,
Color: String,
Budget: 0,
BillingMethod: String,
CostCenter: String,
BillingContact: String,
BillingEmail: String,
ApprovalOn: False,
Threshold: 0,
Active: False,
CreatedBy: String,
CreatedAt: 0001-01-01,
Members: 0
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
Department:
[
{
DepartmentID: 0,
DepartmentUID: 00000000000000000000000000000000,
Name: String,
Description: String,
Code: String,
Color: String,
Budget: 0,
BillingMethod: String,
CostCenter: String,
BillingContact: String,
BillingEmail: String,
ApprovalOn: False,
Threshold: 0,
Active: False,
CreatedBy: String,
CreatedAt: 0001-01-01,
Members: 0
}
]
}