Field Squared API Services

<back to all web services

ContactImport

Bulk import a set of contacts..

The following routes are available for this service:
POST/{Workspace}/ContactImport
import java.math.*;
import java.util.*;
import net.servicestack.client.*;

public class dtos
{

    /**
    * Bulk import a set of contacts..
    */
    public static class ContactImport
    {
        public String Workspace = null;
        public ArrayList<Contact> Contacts = null;
        public String RequestId = null;
        
        public String getWorkspace() { return Workspace; }
        public ContactImport setWorkspace(String value) { this.Workspace = value; return this; }
        public ArrayList<Contact> getContacts() { return Contacts; }
        public ContactImport setContacts(ArrayList<Contact> value) { this.Contacts = value; return this; }
        public String getRequestId() { return RequestId; }
        public ContactImport setRequestId(String value) { this.RequestId = value; return this; }
    }

    /**
    * 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 static class Contact
    {
        public String Workspace = null;
        public String ObjectId = null;
        public String TimeZone = null;
        public String VersionId = null;
        public String BasedOn = null;
        public String ExternalId = null;
        public String ContactName = null;
        public String Company = null;
        public String MobilePhone = null;
        public String WorkPhone = null;
        public String HomePhone = null;
        public String Email = null;
        public Boolean SMS = null;
        public Address Address = null;
        public Boolean Enabled = null;
        public Boolean POI = null;
        public Boolean EmailSiteDriving = null;
        public ArrayList<Address> ServiceAddresses = null;
        public ArrayList<DomainItem> Documents = null;
        public HashMap<String,String> Data = null;
        public ClassedItem Owner = null;
        public ArrayList<String> Tasks = null;
        public ArrayList<String> Assets = null;
        public ArrayList<String> Contacts = null;
        public ArrayList<EventItem> Events = null;
        public ArrayList<String> Teams = null;
        public String Created = null;
        public String LastUpdated = null;
        public String CreatedBy = null;
        public HashMap<String,Object> ActiveLaborTypes = null;
        
        public String getWorkspace() { return Workspace; }
        public Contact setWorkspace(String value) { this.Workspace = value; return this; }
        public String getObjectId() { return ObjectId; }
        public Contact setObjectId(String value) { this.ObjectId = value; return this; }
        public String getTimeZone() { return TimeZone; }
        public Contact setTimeZone(String value) { this.TimeZone = value; return this; }
        public String getVersionId() { return VersionId; }
        public Contact setVersionId(String value) { this.VersionId = value; return this; }
        public String getBasedOn() { return BasedOn; }
        public Contact setBasedOn(String value) { this.BasedOn = value; return this; }
        public String getExternalId() { return ExternalId; }
        public Contact setExternalId(String value) { this.ExternalId = value; return this; }
        public String getContactName() { return ContactName; }
        public Contact setContactName(String value) { this.ContactName = value; return this; }
        public String getCompany() { return Company; }
        public Contact setCompany(String value) { this.Company = value; return this; }
        public String getMobilePhone() { return MobilePhone; }
        public Contact setMobilePhone(String value) { this.MobilePhone = value; return this; }
        public String getWorkPhone() { return WorkPhone; }
        public Contact setWorkPhone(String value) { this.WorkPhone = value; return this; }
        public String getHomePhone() { return HomePhone; }
        public Contact setHomePhone(String value) { this.HomePhone = value; return this; }
        public String getEmail() { return Email; }
        public Contact setEmail(String value) { this.Email = value; return this; }
        public Boolean isSms() { return SMS; }
        public Contact setSms(Boolean value) { this.SMS = value; return this; }
        public Address getAddress() { return Address; }
        public Contact setAddress(Address value) { this.Address = value; return this; }
        public Boolean isEnabled() { return Enabled; }
        public Contact setEnabled(Boolean value) { this.Enabled = value; return this; }
        public Boolean isPoi() { return POI; }
        public Contact setPoi(Boolean value) { this.POI = value; return this; }
        public Boolean isEmailSiteDriving() { return EmailSiteDriving; }
        public Contact setEmailSiteDriving(Boolean value) { this.EmailSiteDriving = value; return this; }
        public ArrayList<Address> getServiceAddresses() { return ServiceAddresses; }
        public Contact setServiceAddresses(ArrayList<Address> value) { this.ServiceAddresses = value; return this; }
        public ArrayList<DomainItem> getDocuments() { return Documents; }
        public Contact setDocuments(ArrayList<DomainItem> value) { this.Documents = value; return this; }
        public HashMap<String,String> getData() { return Data; }
        public Contact setData(HashMap<String,String> value) { this.Data = value; return this; }
        public ClassedItem getOwner() { return Owner; }
        public Contact setOwner(ClassedItem value) { this.Owner = value; return this; }
        public ArrayList<String> getTasks() { return Tasks; }
        public Contact setTasks(ArrayList<String> value) { this.Tasks = value; return this; }
        public ArrayList<String> getAssets() { return Assets; }
        public Contact setAssets(ArrayList<String> value) { this.Assets = value; return this; }
        public ArrayList<String> getContacts() { return Contacts; }
        public Contact setContacts(ArrayList<String> value) { this.Contacts = value; return this; }
        public ArrayList<EventItem> getEvents() { return Events; }
        public Contact setEvents(ArrayList<EventItem> value) { this.Events = value; return this; }
        public ArrayList<String> getTeams() { return Teams; }
        public Contact setTeams(ArrayList<String> value) { this.Teams = value; return this; }
        public String getCreated() { return Created; }
        public Contact setCreated(String value) { this.Created = value; return this; }
        public String getLastUpdated() { return LastUpdated; }
        public Contact setLastUpdated(String value) { this.LastUpdated = value; return this; }
        public String getCreatedBy() { return CreatedBy; }
        public Contact setCreatedBy(String value) { this.CreatedBy = value; return this; }
        public HashMap<String,Object> getActiveLaborTypes() { return ActiveLaborTypes; }
        public Contact setActiveLaborTypes(HashMap<String,Object> value) { this.ActiveLaborTypes = value; return this; }
    }

    public static class Address
    {
        public String Street = null;
        public String Unit = null;
        public String City = null;
        public String State = null;
        public String Zip = null;
        public String ContactTitle = null;
        public String ContactName = null;
        public String ContactPhone = null;
        public String ContactEmail = null;
        public Location Location = null;
        public String SiteName = null;
        public Boolean GeocodeFailed = null;
        public String Country = null;
        
        public String getStreet() { return Street; }
        public Address setStreet(String value) { this.Street = value; return this; }
        public String getUnit() { return Unit; }
        public Address setUnit(String value) { this.Unit = value; return this; }
        public String getCity() { return City; }
        public Address setCity(String value) { this.City = value; return this; }
        public String getState() { return State; }
        public Address setState(String value) { this.State = value; return this; }
        public String getZip() { return Zip; }
        public Address setZip(String value) { this.Zip = value; return this; }
        public String getContactTitle() { return ContactTitle; }
        public Address setContactTitle(String value) { this.ContactTitle = value; return this; }
        public String getContactName() { return ContactName; }
        public Address setContactName(String value) { this.ContactName = value; return this; }
        public String getContactPhone() { return ContactPhone; }
        public Address setContactPhone(String value) { this.ContactPhone = value; return this; }
        public String getContactEmail() { return ContactEmail; }
        public Address setContactEmail(String value) { this.ContactEmail = value; return this; }
        public Location getLocation() { return Location; }
        public Address setLocation(Location value) { this.Location = value; return this; }
        public String getSiteName() { return SiteName; }
        public Address setSiteName(String value) { this.SiteName = value; return this; }
        public Boolean isGeocodeFailed() { return GeocodeFailed; }
        public Address setGeocodeFailed(Boolean value) { this.GeocodeFailed = value; return this; }
        public String getCountry() { return Country; }
        public Address setCountry(String value) { this.Country = value; return this; }
    }

    public static class Location
    {
        public Double y = null;
        public Double x = null;
        
        public Double getY() { return y; }
        public Location setY(Double value) { this.y = value; return this; }
        public Double getX() { return x; }
        public Location setX(Double value) { this.x = value; return this; }
    }

    public static class DomainItem
    {
        public String Workspace = null;
        public String ObjectId = null;
        public String VersionId = null;
        public String LastUpdated = null;
        
        public String getWorkspace() { return Workspace; }
        public DomainItem setWorkspace(String value) { this.Workspace = value; return this; }
        public String getObjectId() { return ObjectId; }
        public DomainItem setObjectId(String value) { this.ObjectId = value; return this; }
        public String getVersionId() { return VersionId; }
        public DomainItem setVersionId(String value) { this.VersionId = value; return this; }
        public String getLastUpdated() { return LastUpdated; }
        public DomainItem setLastUpdated(String value) { this.LastUpdated = value; return this; }
    }

    public static class ClassedItem
    {
        public String ObjectId = null;
        public String Class = null;
        public String VersionId = null;
        public ArrayList<String> Ancestors = null;
        public String Type = null;
        
        public String getObjectId() { return ObjectId; }
        public ClassedItem setObjectId(String value) { this.ObjectId = value; return this; }
        public String getClass() { return Class; }
        public ClassedItem setClass(String value) { this.Class = value; return this; }
        public String getVersionId() { return VersionId; }
        public ClassedItem setVersionId(String value) { this.VersionId = value; return this; }
        public ArrayList<String> getAncestors() { return Ancestors; }
        public ClassedItem setAncestors(ArrayList<String> value) { this.Ancestors = value; return this; }
        public String getType() { return Type; }
        public ClassedItem setType(String value) { this.Type = value; return this; }
    }

    public static class EventItem
    {
        public String ObjectId = null;
        public String Date = null;
        public Location Location = null;
        public String Barcode = null;
        public String Details = null;
        public String Type = null;
        public Boolean IsScan = null;
        public String User = null;
        public String SelectedBy = null;
        public String Status = null;
        public String StatusType = null;
        public String DateCreated = null;
        public Boolean Automatic = null;
        
        public String getObjectId() { return ObjectId; }
        public EventItem setObjectId(String value) { this.ObjectId = value; return this; }
        public String getDate() { return Date; }
        public EventItem setDate(String value) { this.Date = value; return this; }
        public Location getLocation() { return Location; }
        public EventItem setLocation(Location value) { this.Location = value; return this; }
        public String getBarcode() { return Barcode; }
        public EventItem setBarcode(String value) { this.Barcode = value; return this; }
        public String getDetails() { return Details; }
        public EventItem setDetails(String value) { this.Details = value; return this; }
        public String getType() { return Type; }
        public EventItem setType(String value) { this.Type = value; return this; }
        public Boolean getIsScan() { return IsScan; }
        public EventItem setIsScan(Boolean value) { this.IsScan = value; return this; }
        public String getUser() { return User; }
        public EventItem setUser(String value) { this.User = value; return this; }
        public String getSelectedBy() { return SelectedBy; }
        public EventItem setSelectedBy(String value) { this.SelectedBy = value; return this; }
        public String getStatus() { return Status; }
        public EventItem setStatus(String value) { this.Status = value; return this; }
        public String getStatusType() { return StatusType; }
        public EventItem setStatusType(String value) { this.StatusType = value; return this; }
        public String getDateCreated() { return DateCreated; }
        public EventItem setDateCreated(String value) { this.DateCreated = value; return this; }
        public Boolean isAutomatic() { return Automatic; }
        public EventItem setAutomatic(Boolean value) { this.Automatic = value; return this; }
    }

}

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

{
	Workspace: String,
	Contacts: 
	[
		{
			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: {}
			}
		}
	],
	RequestId: String
}