Field Squared API Services

<back to all web services

Team

Represents a DTO for a team in a workspace. Calls without an ObjectId will retrieve an array of all team objects for the workspace.

The following routes are available for this service:
GET,POST,PUT,DELETE/{Workspace}/Team/{ObjectId}
GET/{Workspace}/Team
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 DomainItem:
    workspace: Optional[str] = None
    object_id: Optional[str] = None
    version_id: Optional[str] = None
    last_updated: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Location:
    y: float = 0.0
    x: float = 0.0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Address:
    street: Optional[str] = None
    unit: Optional[str] = None
    city: Optional[str] = None
    state: Optional[str] = None
    zip: Optional[str] = None
    contact_title: Optional[str] = None
    contact_name: Optional[str] = None
    contact_phone: Optional[str] = None
    contact_email: Optional[str] = None
    location: Optional[Location] = None
    site_name: Optional[str] = None
    geocode_failed: bool = False
    country: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EventItem:
    object_id: Optional[str] = None
    date: Optional[str] = None
    location: Optional[Location] = None
    barcode: Optional[str] = None
    details: Optional[str] = None
    type: Optional[str] = None
    is_scan: bool = False
    user: Optional[str] = None
    selected_by: Optional[str] = None
    status: Optional[str] = None
    status_type: Optional[str] = None
    date_created: Optional[str] = None
    automatic: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Team:
    """
    Represents a DTO for a team in a workspace. Calls without an ObjectId will retrieve an array of all team objects for the workspace.
    """

    workspace: Optional[str] = None
    time_zone: Optional[str] = None
    object_id: Optional[str] = None
    external_id: Optional[str] = None
    version_id: Optional[str] = None
    based_on: Optional[str] = None
    name: Optional[str] = None
    enabled: bool = False
    members: Optional[List[DomainItem]] = None
    lead: Optional[DomainItem] = None
    parent: Optional[DomainItem] = None
    address: Optional[Address] = None
    data: Optional[Dict[str, str]] = None
    teams: Optional[List[str]] = None
    events: Optional[List[EventItem]] = None
    created_by: Optional[str] = None
    active_labor_types: Optional[Dict[str, Object]] = None

Python Team 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 /{Workspace}/Team/{ObjectId} HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Workspace: String,
	TimeZone: String,
	ObjectId: String,
	ExternalId: String,
	VersionId: String,
	BasedOn: String,
	Name: String,
	Enabled: False,
	Members: 
	[
		{
			Workspace: String,
			ObjectId: String,
			VersionId: String,
			LastUpdated: String
		}
	],
	Lead: 
	{
		Workspace: String,
		ObjectId: String,
		VersionId: String,
		LastUpdated: String
	},
	Parent: 
	{
		Workspace: String,
		ObjectId: String,
		VersionId: String,
		LastUpdated: String
	},
	Address: 
	{
		Street: String,
		Unit: String,
		City: String,
		State: String,
		Zip: String,
		ContactTitle: String,
		ContactName: String,
		ContactPhone: String,
		ContactEmail: String,
		Location: 
		{
			y: 0,
			x: 0
		},
		SiteName: String,
		GeocodeFailed: False,
		Country: String
	},
	Data: 
	{
		String: String
	},
	Teams: 
	[
		String
	],
	Events: 
	[
		{
			ObjectId: String,
			Date: String,
			Location: 
			{
				y: 0,
				x: 0
			},
			Barcode: String,
			Details: String,
			Type: String,
			IsScan: False,
			User: String,
			SelectedBy: String,
			Status: String,
			StatusType: String,
			DateCreated: String,
			Automatic: False
		}
	],
	CreatedBy: String,
	ActiveLaborTypes: 
	{
		String: {}
	}
}