Field Squared API Services

<back to all web services

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.

The following routes are available for this service:
GET,POST,PUT,DELETE/{Workspace}/User/{ObjectId}
GET/{Workspace}/User
import Foundation
import ServiceStack

/**
* Represents a DTO for a user in a workspace. Calls without an ObjectId will retrieve an array of all user objects for the workspace.
*/
public class User : Codable
{
    public var workspace:String
    public var timeZone:String
    public var objectId:String
    public var versionId:String
    public var created:String
    public var lastUpdated:String
    public var basedOn:String
    public var externalId:String
    public var name:String
    public var initials:String
    public var phone:String
    public var email:String
    public var password:String
    public var requestUser:String
    public var location:Location
    public var userType:String
    public var proposedRoute:[Location] = []
    public var actualRoute:[Location] = []
    public var image:String
    public var userStatus:UserStatus
    public var recordStatus:String
    public var documents:[String] = []
    public var subscribeToEmails:Bool
    public var address:Address
    public var skillTags:[String] = []
    public var enabled:Bool
    public var uiPrefTaskColumnsOff:[String] = []
    public var uiPrefTaskColumns:[UIColumnPref] = []
    public var data:[String:String] = [:]
    public var teams:[String] = []
    public var events:[EventItem] = []
    public var color:String
    public var vehicleAsset:String
    public var externalAuth:Bool
    public var createdBy:String
    public var serviceAccount:Bool
    public var assets:[String] = []
    public var tfaRequired:Bool
    public var tfaPreference:String
    public var workWeek:[WorkDay] = []
    public var customSchedulesEnabled:Bool
    public var customSchedules:[CustomSchedule] = []
    public var overrideSso:Bool

    required public init(){}
}

public class Location : Codable
{
    public var y:Double
    public var x:Double

    required public init(){}
}

public enum UserStatus : String, Codable
{
    case NotStarted
    case Driving
    case InProgress
    case Complete
    case Blocked
}

public class Address : Codable
{
    public var street:String
    public var unit:String
    public var city:String
    public var state:String
    public var zip:String
    public var contactTitle:String
    public var contactName:String
    public var contactPhone:String
    public var contactEmail:String
    public var location:Location
    public var siteName:String
    public var geocodeFailed:Bool
    public var country:String

    required public init(){}
}

public class UIColumnPref : Codable
{
    public var name:String
    public var width:Double

    required public init(){}
}

public class EventItem : Codable
{
    public var objectId:String
    public var date:String
    public var location:Location
    public var barcode:String
    public var details:String
    public var type:String
    public var isScan:Bool
    public var user:String
    public var selectedBy:String
    public var status:String
    public var statusType:String
    public var dateCreated:String
    public var automatic:Bool

    required public init(){}
}

public class WorkDay : Codable
{
    public var dayOfWeek:Int
    public var start:Int
    public var end:Int
    public var lunch:Int

    required public init(){}
}

public class CustomSchedule : Codable
{
    public var date:String
    public var start:Int
    public var end:Int
    public var type:String

    required public init(){}
}


Swift User 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}/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
}