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

export class Location
{
    public y: number;
    public x: number;

    public constructor(init?: Partial<Location>) { (Object as any).assign(this, init); }
}

export class Address
{
    public Street: string;
    public Unit: string;
    public City: string;
    public State: string;
    public Zip: string;
    public ContactTitle: string;
    public ContactName: string;
    public ContactPhone: string;
    public ContactEmail: string;
    public Location: Location;
    public SiteName: string;
    public GeocodeFailed: boolean;
    public Country: string;

    public constructor(init?: Partial<Address>) { (Object as any).assign(this, init); }
}

export class DomainItem
{
    public Workspace: string;
    public ObjectId: string;
    public VersionId: string;
    public LastUpdated: string;

    public constructor(init?: Partial<DomainItem>) { (Object as any).assign(this, init); }
}

export class ClassedItem
{
    public ObjectId: string;
    public Class: string;
    public VersionId: string;
    public Ancestors: string[];
    public Type: string;

    public constructor(init?: Partial<ClassedItem>) { (Object as any).assign(this, init); }
}

export class EventItem
{
    public ObjectId: string;
    public Date: string;
    public Location: Location;
    public Barcode: string;
    public Details: string;
    public Type: string;
    public IsScan: boolean;
    public User: string;
    public SelectedBy: string;
    public Status: string;
    public StatusType: string;
    public DateCreated: string;
    public Automatic: boolean;

    public constructor(init?: Partial<EventItem>) { (Object as any).assign(this, init); }
}

/** @description 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 */
export class Contact
{
    public Workspace: string;
    public ObjectId: string;
    public TimeZone: string;
    public VersionId: string;
    public BasedOn: string;
    public ExternalId: string;
    public ContactName: string;
    public Company: string;
    public MobilePhone: string;
    public WorkPhone: string;
    public HomePhone: string;
    public Email: string;
    public SMS: boolean;
    public Address: Address;
    public Enabled: boolean;
    public POI: boolean;
    public EmailSiteDriving: boolean;
    public ServiceAddresses: Address[];
    public Documents: DomainItem[];
    public Data: { [index: string]: string; };
    public Owner: ClassedItem;
    public Tasks: string[];
    public Assets: string[];
    public Contacts: string[];
    public Events: EventItem[];
    public Teams: string[];
    public Created: string;
    public LastUpdated: string;
    public CreatedBy: string;
    public ActiveLaborTypes: { [index: string]: Object; };

    public constructor(init?: Partial<Contact>) { (Object as any).assign(this, init); }
}

// @DataContract
export class PublicContact
{
    // @DataMember
    public Id: string;

    // @DataMember
    public Workspace: string;

    // @DataMember
    public Contact: Contact;

    // @DataMember
    public Contacts: Contact[];

    public constructor(init?: Partial<PublicContact>) { (Object as any).assign(this, init); }
}

TypeScript 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: {}
			}
		}
	]
}