Field Squared API Services

<back to all web services

PublicContact

The following routes are available for this service:
GET/{Workspace}/API/Contact/Schema
GET, PUT, POST, DELETE/{Workspace}/API/Contact/{Id}
GET, PUT, POST, DELETE/{Workspace}/API/Contact
import java.math.*
import java.util.*
import net.servicestack.client.*


@DataContract
open class PublicContact
{
    @DataMember
    var Id:String? = null

    @DataMember
    var Workspace:String? = null

    @DataMember
    var Contact:Contact? = null

    @DataMember
    var Contacts:ArrayList<Contact> = ArrayList<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
*/
open class Contact
{
    var Workspace:String? = null
    var ObjectId:String? = null
    var TimeZone:String? = null
    var VersionId:String? = null
    var BasedOn:String? = null
    var ExternalId:String? = null
    var ContactName:String? = null
    var Company:String? = null
    var MobilePhone:String? = null
    var WorkPhone:String? = null
    var HomePhone:String? = null
    var Email:String? = null
    var SMS:Boolean? = null
    var Address:Address? = null
    var Enabled:Boolean? = null
    var POI:Boolean? = null
    var EmailSiteDriving:Boolean? = null
    var ServiceAddresses:ArrayList<Address> = ArrayList<Address>()
    var Documents:ArrayList<DomainItem> = ArrayList<DomainItem>()
    var Data:HashMap<String,String> = HashMap<String,String>()
    var Owner:ClassedItem? = null
    var Tasks:ArrayList<String> = ArrayList<String>()
    var Assets:ArrayList<String> = ArrayList<String>()
    var Contacts:ArrayList<String> = ArrayList<String>()
    var Events:ArrayList<EventItem> = ArrayList<EventItem>()
    var Teams:ArrayList<String> = ArrayList<String>()
    var Created:String? = null
    var LastUpdated:String? = null
    var CreatedBy:String? = null
    var ActiveLaborTypes:HashMap<String,Object> = HashMap<String,Object>()
}

open class Address
{
    var Street:String? = null
    var Unit:String? = null
    var City:String? = null
    var State:String? = null
    var Zip:String? = null
    var ContactTitle:String? = null
    var ContactName:String? = null
    var ContactPhone:String? = null
    var ContactEmail:String? = null
    var Location:Location? = null
    var SiteName:String? = null
    var GeocodeFailed:Boolean? = null
    var Country:String? = null
}

open class Location
{
    var y:Double? = null
    var x:Double? = null
}

open class DomainItem
{
    var Workspace:String? = null
    var ObjectId:String? = null
    var VersionId:String? = null
    var LastUpdated:String? = null
}

open class ClassedItem
{
    var ObjectId:String? = null
    var Class:String? = null
    var VersionId:String? = null
    var Ancestors:ArrayList<String> = ArrayList<String>()
    var Type:String? = null
}

open class EventItem
{
    var ObjectId:String? = null
    var Date:String? = null
    var Location:Location? = null
    var Barcode:String? = null
    var Details:String? = null
    var Type:String? = null
    var IsScan:Boolean? = null
    var User:String? = null
    var SelectedBy:String? = null
    var Status:String? = null
    var StatusType:String? = null
    var DateCreated:String? = null
    var Automatic:Boolean? = null
}

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

{
	Id: String,
	Workspace: String,
	Contact: 
	{
		ExternalId: String,
		ContactName: String,
		Company: String,
		MobilePhone: String,
		WorkPhone: String,
		HomePhone: String,
		Email: String,
		Lat: 0,
		Lon: 0,
		StreetAddress: String,
		Unit: String,
		City: String,
		State: String,
		Zip: String,
		Country: String,
		Team: String,
		Tasks: 
		[
			String
		],
		Enabled: False,
		LastUpdated: String,
		Created: String,
		Data: 
		{
			String: {}
		}
	},
	Contacts: 
	[
		{
			ExternalId: String,
			ContactName: String,
			Company: String,
			MobilePhone: String,
			WorkPhone: String,
			HomePhone: String,
			Email: String,
			Lat: 0,
			Lon: 0,
			StreetAddress: String,
			Unit: String,
			City: String,
			State: String,
			Zip: String,
			Country: String,
			Team: String,
			Tasks: 
			[
				String
			],
			Enabled: False,
			LastUpdated: String,
			Created: String,
			Data: 
			{
				String: {}
			}
		}
	]
}