| GET,POST,PUT,DELETE | /{Workspace}/User/{ObjectId} | ||
|---|---|---|---|
| GET | /{Workspace}/User |
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 Location:
y: float = 0.0
x: float = 0.0
class UserStatus(str, Enum):
NOT_STARTED = 'NotStarted'
DRIVING = 'Driving'
IN_PROGRESS = 'InProgress'
COMPLETE = 'Complete'
BLOCKED = 'Blocked'
@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 UIColumnPref:
name: Optional[str] = None
width: float = 0.0
@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 WorkDay:
day_of_week: int = 0
start: int = 0
end: int = 0
lunch: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomSchedule:
date: Optional[str] = None
start: int = 0
end: int = 0
type: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class User:
"""
Represents a DTO for a user in a workspace. Calls without an ObjectId will retrieve an array of all user objects for the workspace.
"""
workspace: Optional[str] = None
time_zone: Optional[str] = None
object_id: Optional[str] = None
version_id: Optional[str] = None
created: Optional[str] = None
last_updated: Optional[str] = None
based_on: Optional[str] = None
external_id: Optional[str] = None
name: Optional[str] = None
initials: Optional[str] = None
phone: Optional[str] = None
email: Optional[str] = None
password: Optional[str] = None
request_user: Optional[str] = None
location: Optional[Location] = None
user_type: Optional[str] = None
proposed_route: Optional[List[Location]] = None
actual_route: Optional[List[Location]] = None
image: Optional[str] = None
user_status: Optional[UserStatus] = None
record_status: Optional[str] = None
documents: Optional[List[str]] = None
subscribe_to_emails: bool = False
address: Optional[Address] = None
skill_tags: Optional[List[str]] = None
enabled: bool = False
ui_pref_task_columns_off: Optional[List[str]] = None
ui_pref_task_columns: Optional[List[UIColumnPref]] = None
data: Optional[Dict[str, str]] = None
teams: Optional[List[str]] = None
events: Optional[List[EventItem]] = None
color: Optional[str] = None
vehicle_asset: Optional[str] = None
external_auth: bool = False
created_by: Optional[str] = None
service_account: bool = False
assets: Optional[List[str]] = None
tfa_required: bool = False
tfa_preference: Optional[str] = None
work_week: Optional[List[WorkDay]] = None
custom_schedules_enabled: bool = False
custom_schedules: Optional[List[CustomSchedule]] = None
override_sso: bool = False
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 /{Workspace}/User/{ObjectId} HTTP/1.1
Host: dev.fieldsquared.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Workspace: String,
TimeZone: String,
ObjectId: String,
VersionId: String,
Created: String,
LastUpdated: String,
BasedOn: String,
ExternalId: String,
Name: String,
Initials: String,
Phone: String,
Email: String,
Password: String,
RequestUser: String,
Location:
{
y: 0,
x: 0
},
UserType: String,
ProposedRoute:
[
{
y: 0,
x: 0
}
],
ActualRoute:
[
{
y: 0,
x: 0
}
],
Image: String,
UserStatus: NotStarted,
RecordStatus: String,
Documents:
[
String
],
SubscribeToEmails: False,
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
},
SkillTags:
[
String
],
Enabled: False,
UIPrefTaskColumnsOff:
[
String
],
UIPrefTaskColumns:
[
{
Name: String,
Width: 0
}
],
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
}
],
Color: String,
VehicleAsset: String,
ExternalAuth: False,
CreatedBy: String,
ServiceAccount: False,
Assets:
[
String
],
TfaRequired: False,
TfaPreference: String,
WorkWeek:
[
{
DayOfWeek: 0,
Start: 0,
End: 0,
Lunch: 0
}
],
CustomSchedulesEnabled: False,
CustomSchedules:
[
{
Date: String,
Start: 0,
End: 0,
Type: String
}
],
OverrideSso: False
}