Field Squared API Services

<back to all web services

Contact

Represents a DTO for a contact in a workspace. Calls without an ObjectId will retrieve an array of all active contact objects for the workspace.
A call to /{Workspace}/ContactTasks/{ObjectId} will return a List<DomainItem> for the list of tasks associated to the contact.
A core or custom sort field can be specified by using sort=fieldname&sortorder=ascending/descending.
To filter for contacts based on full text search, use fulltext
Custom contact field 'contains' filters can also be specified by using the binding/key as the query parameter. i.e. Comments=Quick Brown Fox.
To filter and return all contacts modified since a date and time, use the query parameter modifiedsince = X where X = YYYY-MM-DDTHH:MM:SSZ
To filter and return all contacts deleted since a date and time, use the query parameter deletedsince = X where X = YYYY-MM-DDTHH:MM:SSZ. Note only Object ID, Workspace and Version is populated.
Spatial extents can be passed in using: bottomleft=Lat,Lon&topright=Lat,Lon.
To filter on tasks inside a boundary, use boundary=Lat,Lon,Lat,Lon etc.
Pagination - /{0}/ContactList?recstart=0&reccount=1
/{Workspace}/ContactList/Count returns a count, not the actual object list

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

/**
* Represents a DTO for a contact in a workspace.  Calls without an ObjectId will retrieve an array of all active contact objects for the workspace.A call to /{Workspace}/ContactTasks/{ObjectId} will return a List<DomainItem> for the list of tasks associated to the contact.A core or custom sort field can be specified by using sort=fieldname&sortorder=ascending/descending. To filter for contacts based on full text search, use fulltext Custom contact field 'contains' filters can also be specified by using the binding/key as the query parameter. i.e. Comments=Quick Brown Fox. To filter and return all contacts modified since a date and time, use the query parameter modifiedsince = X where X = YYYY-MM-DDTHH:MM:SSZ To filter and return all contacts deleted since a date and time, use the query parameter deletedsince = X where X = YYYY-MM-DDTHH:MM:SSZ.  Note only Object ID, Workspace and Version is populated. Spatial extents can be passed in using: bottomleft=Lat,Lon&topright=Lat,Lon.  To filter on tasks inside a boundary, use boundary=Lat,Lon,Lat,Lon etc. Pagination - /{0}/ContactList?recstart=0&reccount=1  /{Workspace}/ContactList/Count returns a count, not the actual object list
*/
public class Contact : Codable
{
    public var workspace:String
    public var objectId:String
    public var timeZone:String
    public var versionId:String
    public var basedOn:String
    public var externalId:String
    public var contactName:String
    public var company:String
    public var mobilePhone:String
    public var workPhone:String
    public var homePhone:String
    public var email:String
    public var sms:Bool
    public var address:Address
    public var enabled:Bool
    public var poi:Bool
    public var emailSiteDriving:Bool
    public var serviceAddresses:[Address] = []
    public var documents:[DomainItem] = []
    public var data:[String:String] = [:]
    public var owner:ClassedItem
    public var tasks:[String] = []
    public var assets:[String] = []
    public var contacts:[String] = []
    public var events:[EventItem] = []
    public var teams:[String] = []
    public var created:String
    public var lastUpdated:String
    public var createdBy:String
    public var activeLaborTypes:[String:Object] = [:]

    required public init(){}
}

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 Location : Codable
{
    public var y:Double
    public var x:Double

    required public init(){}
}

public class DomainItem : Codable
{
    public var workspace:String
    public var objectId:String
    public var versionId:String
    public var lastUpdated:String

    required public init(){}
}

public class ClassedItem : Codable
{
    public var objectId:String
    public var `class`:String
    public var versionId:String
    public var ancestors:[String] = []
    public var type:String

    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(){}
}


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

{
	Workspace: String,
	ObjectId: String,
	TimeZone: String,
	VersionId: String,
	BasedOn: String,
	ExternalId: String,
	ContactName: String,
	Company: String,
	MobilePhone: String,
	WorkPhone: String,
	HomePhone: String,
	Email: String,
	SMS: 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
	},
	Enabled: False,
	POI: False,
	EmailSiteDriving: False,
	ServiceAddresses: 
	[
		{
			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
		}
	],
	Documents: 
	[
		{
			Workspace: String,
			ObjectId: String,
			VersionId: String,
			LastUpdated: String
		}
	],
	Data: 
	{
		String: String
	},
	Owner: 
	{
		ObjectId: String,
		Class: String,
		VersionId: String,
		Ancestors: 
		[
			String
		],
		Type: String
	},
	Tasks: 
	[
		String
	],
	Assets: 
	[
		String
	],
	Contacts: 
	[
		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
		}
	],
	Teams: 
	[
		String
	],
	Created: String,
	LastUpdated: String,
	CreatedBy: String,
	ActiveLaborTypes: 
	{
		String: {}
	}
}