| GET,POST,PUT,DELETE,OPTIONS | /v1/Project/Invoice/{ProjectID}/{InvoiceStartDate}/{InvoiceEndDate} |
|---|
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 ProjectInvoice:
cost_type: Optional[str] = None
cost_name: Optional[str] = None
cost_to_date: Decimal = decimal.Decimal(0)
job_i_d: int = 0
rate: Decimal = decimal.Decimal(0)
hours: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProjectInvoiceResponse:
response_status: Optional[ResponseStatus] = None
project_invoice: List[ProjectInvoice] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProjectInvoiceRequest:
project_i_d: int = 0
invoice_start_date: datetime.datetime = datetime.datetime(1, 1, 1)
invoice_end_date: datetime.datetime = datetime.datetime(1, 1, 1)
Python ProjectInvoiceRequest DTOs
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/Project/Invoice/{ProjectID}/{InvoiceStartDate}/{InvoiceEndDate} HTTP/1.1
Host: api.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ProjectID: 0,
InvoiceStartDate: 0001-01-01,
InvoiceEndDate: 0001-01-01
}
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
}
},
ProjectInvoice:
[
{
CostType: String,
CostName: String,
CostToDate: 0,
JobID: 0,
Rate: 0,
Hours: 0
}
]
}