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 .jsv suffix or ?format=jsv

HTTP + JSV

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: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	BranchId: 00000000000000000000000000000000,
	FromDate: 0001-01-01,
	ToDate: 0001-01-01,
	StationId: 00000000000000000000000000000000,
	EmployeeId: 00000000000000000000000000000000,
	Outcome: String,
	LineId: 00000000000000000000000000000000,
	Page: 0,
	PageSize: 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
		}
	},
	Visits: 
	{
		Rows: 
		[
			{
				CheckinId: 00000000000000000000000000000000,
				TicketLabel: String,
				LocalDate: 0001-01-01,
				LineId: 00000000000000000000000000000000,
				ServiceName: String,
				StationId: 00000000000000000000000000000000,
				StationName: String,
				EmployeeId: 00000000000000000000000000000000,
				EmployeeName: String,
				CustomerName: String,
				ContactId: 0,
				ContactAgentId: 0,
				CustomerId: 00000000000000000000000000000000,
				IsAppointment: False,
				LocalHere: 0001-01-01,
				LocalCalled: 0001-01-01,
				LocalStart: 0001-01-01,
				LocalEnd: 0001-01-01,
				WaitSec: 0,
				ServeSec: 0,
				Outcome: String,
				Fee: 0
			}
		],
		TotalRows: 0,
		Page: 0,
		PageSize: 0,
		OutcomeCounts: 
		{
			String: 0
		},
		Services: 
		[
			{
				LineId: 00000000000000000000000000000000,
				Name: String,
				N: 0
			}
		],
		CanSeeStaff: False,
		CanSeeFinancial: False
	}
}