| Requires any of the roles: | Worker, Agent, Administrator |
| POST,OPTIONS | /v1/TimeTracker/History/{AgentId} |
|---|
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 TimeCard:
agent_id: int = 0
check_in_id: int = 0
date_logged: datetime.datetime = datetime.datetime(1, 1, 1)
time_in: datetime.timedelta = datetime.timedelta()
time_in_date: datetime.datetime = datetime.datetime(1, 1, 1)
time_out: datetime.timedelta = datetime.timedelta()
time_out_date: datetime.datetime = datetime.datetime(1, 1, 1)
time_logged: Decimal = decimal.Decimal(0)
payment_type: int = 0
service_code_id: int = 0
service_code: Optional[str] = None
service_rate: Decimal = decimal.Decimal(0)
service_description: Optional[str] = None
work_description: Optional[str] = None
adjusted_time_in: datetime.timedelta = datetime.timedelta()
adjusted_time_in_date: datetime.datetime = datetime.datetime(1, 1, 1)
adjusted_time_out: datetime.timedelta = datetime.timedelta()
adjusted_time_out_date: datetime.datetime = datetime.datetime(1, 1, 1)
is_valid: bool = False
adjusted: bool = False
project_i_d: int = 0
project_name: Optional[str] = None
client_i_d: int = 0
client_name: Optional[str] = None
category_i_d: int = 0
category_name: Optional[str] = None
job_i_d: int = 0
job_name: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TimetrackerHistoryResponse:
response_status: Optional[ResponseStatus] = None
time_tracker_history: List[TimeCard] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TimetrackerHistoryRequest:
agent_id: int = 0
min_date: Optional[datetime.datetime] = None
max_date: Optional[datetime.datetime] = None
Python TimetrackerHistoryRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/TimeTracker/History/{AgentId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<TimetrackerHistoryRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<AgentId>0</AgentId>
<MaxDate>0001-01-01T00:00:00</MaxDate>
<MinDate>0001-01-01T00:00:00</MinDate>
</TimetrackerHistoryRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<TimetrackerHistoryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
<TimeTrackerHistory>
<TimeCard>
<Adjusted>false</Adjusted>
<AdjustedTimeIn>PT0S</AdjustedTimeIn>
<AdjustedTimeInDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
<d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
<d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
</AdjustedTimeInDate>
<AdjustedTimeOut>PT0S</AdjustedTimeOut>
<AdjustedTimeOutDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
<d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
<d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
</AdjustedTimeOutDate>
<AgentId>0</AgentId>
<CategoryID>0</CategoryID>
<CategoryName>String</CategoryName>
<CheckInId>0</CheckInId>
<ClientID>0</ClientID>
<ClientName>String</ClientName>
<DateLogged>0001-01-01T00:00:00</DateLogged>
<IsValid>false</IsValid>
<JobID>0</JobID>
<JobName>String</JobName>
<PaymentType>0</PaymentType>
<ProjectID>0</ProjectID>
<ProjectName>String</ProjectName>
<ServiceCode>String</ServiceCode>
<ServiceCodeId>0</ServiceCodeId>
<ServiceDescription>String</ServiceDescription>
<ServiceRate>0</ServiceRate>
<TimeIn>PT0S</TimeIn>
<TimeInDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
<d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
<d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
</TimeInDate>
<TimeLogged>0</TimeLogged>
<TimeOut>PT0S</TimeOut>
<TimeOutDate xmlns:d4p1="http://schemas.datacontract.org/2004/07/System">
<d4p1:DateTime>0001-01-01T00:00:00Z</d4p1:DateTime>
<d4p1:OffsetMinutes>0</d4p1:OffsetMinutes>
</TimeOutDate>
<WorkDescription>String</WorkDescription>
</TimeCard>
</TimeTrackerHistory>
</TimetrackerHistoryResponse>