Trendsic Platform Service

<back to all web services

KpiV2VisitsRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dashboard/kpiv2/visits
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 SvcVisitRow:
    checkin_id: Optional[str] = None
    ticket_label: Optional[str] = None
    local_date: datetime.datetime = datetime.datetime(1, 1, 1)
    line_id: Optional[str] = None
    service_name: Optional[str] = None
    station_id: Optional[str] = None
    station_name: Optional[str] = None
    employee_id: Optional[str] = None
    employee_name: Optional[str] = None
    customer_name: Optional[str] = None
    contact_id: Optional[int] = None
    contact_agent_id: Optional[int] = None
    customer_id: Optional[str] = None
    is_appointment: bool = False
    local_here: Optional[datetime.datetime] = None
    local_called: Optional[datetime.datetime] = None
    local_start: Optional[datetime.datetime] = None
    local_end: Optional[datetime.datetime] = None
    wait_sec: Optional[int] = None
    serve_sec: Optional[int] = None
    outcome: Optional[str] = None
    fee: Optional[Decimal] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcChip:
    line_id: Optional[str] = None
    name: Optional[str] = None
    n: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcVisitPage:
    rows: List[SvcVisitRow] = field(default_factory=list)
    total_rows: int = 0
    page: int = 0
    page_size: int = 0
    outcome_counts: Dict[str, int] = field(default_factory=dict)
    services: List[SvcChip] = field(default_factory=list)
    can_see_staff: bool = False
    can_see_financial: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class KpiV2VisitsResponse:
    response_status: Optional[ResponseStatus] = None
    visits: Optional[SvcVisitPage] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class KpiV2VisitsRequest:
    branch_id: Optional[str] = None
    from_date: datetime.datetime = datetime.datetime(1, 1, 1)
    to_date: datetime.datetime = datetime.datetime(1, 1, 1)
    station_id: Optional[str] = None
    employee_id: Optional[str] = None
    outcome: Optional[str] = None
    line_id: Optional[str] = None
    page: int = 0
    page_size: int = 0

Python KpiV2VisitsRequest DTOs

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

HTTP + XML

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

POST /v1/dashboard/kpiv2/visits HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<KpiV2VisitsRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <BranchId>00000000-0000-0000-0000-000000000000</BranchId>
  <EmployeeId>00000000-0000-0000-0000-000000000000</EmployeeId>
  <FromDate>0001-01-01T00:00:00</FromDate>
  <LineId>00000000-0000-0000-0000-000000000000</LineId>
  <Outcome>String</Outcome>
  <Page>0</Page>
  <PageSize>0</PageSize>
  <StationId>00000000-0000-0000-0000-000000000000</StationId>
  <ToDate>0001-01-01T00:00:00</ToDate>
</KpiV2VisitsRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<KpiV2VisitsResponse 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>
  <Visits>
    <CanSeeFinancial>false</CanSeeFinancial>
    <CanSeeStaff>false</CanSeeStaff>
    <OutcomeCounts xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringint>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>0</d3p1:Value>
      </d3p1:KeyValueOfstringint>
    </OutcomeCounts>
    <Page>0</Page>
    <PageSize>0</PageSize>
    <Rows>
      <SvcVisitRow>
        <CheckinId>00000000-0000-0000-0000-000000000000</CheckinId>
        <ContactAgentId>0</ContactAgentId>
        <ContactId>0</ContactId>
        <CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
        <CustomerName>String</CustomerName>
        <EmployeeId>00000000-0000-0000-0000-000000000000</EmployeeId>
        <EmployeeName>String</EmployeeName>
        <Fee>0</Fee>
        <IsAppointment>false</IsAppointment>
        <LineId>00000000-0000-0000-0000-000000000000</LineId>
        <LocalCalled>0001-01-01T00:00:00</LocalCalled>
        <LocalDate>0001-01-01T00:00:00</LocalDate>
        <LocalEnd>0001-01-01T00:00:00</LocalEnd>
        <LocalHere>0001-01-01T00:00:00</LocalHere>
        <LocalStart>0001-01-01T00:00:00</LocalStart>
        <Outcome>String</Outcome>
        <ServeSec>0</ServeSec>
        <ServiceName>String</ServiceName>
        <StationId>00000000-0000-0000-0000-000000000000</StationId>
        <StationName>String</StationName>
        <TicketLabel>String</TicketLabel>
        <WaitSec>0</WaitSec>
      </SvcVisitRow>
    </Rows>
    <Services>
      <SvcChip>
        <LineId>00000000-0000-0000-0000-000000000000</LineId>
        <N>0</N>
        <Name>String</Name>
      </SvcChip>
    </Services>
    <TotalRows>0</TotalRows>
  </Visits>
</KpiV2VisitsResponse>