| GET,POST,PUT,DELETE | /{Workspace}/Contact/{ObjectId} | ||
|---|---|---|---|
| GET | /{Workspace}/Contact | ||
| GET | /{Workspace}/ContactList | ||
| GET | /{Workspace}/ContactList/Count | ||
| GET | /{Workspace}/ContactTasks/{ObjectId} |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using Field2Office.API.Model.Contacts;
using Field2Office.API.Model;
namespace Field2Office.API.Model
{
public partial class Address
{
public virtual string Street { get; set; }
public virtual string Unit { get; set; }
public virtual string City { get; set; }
public virtual string State { get; set; }
public virtual string Zip { get; set; }
public virtual string ContactTitle { get; set; }
public virtual string ContactName { get; set; }
public virtual string ContactPhone { get; set; }
public virtual string ContactEmail { get; set; }
public virtual Location Location { get; set; }
public virtual string SiteName { get; set; }
public virtual bool GeocodeFailed { get; set; }
public virtual string Country { get; set; }
}
public partial class ClassedItem
{
public ClassedItem()
{
Ancestors = new List<string>{};
}
public virtual string ObjectId { get; set; }
public virtual string Class { get; set; }
public virtual string VersionId { get; set; }
public virtual List<string> Ancestors { get; set; }
public virtual string Type { get; set; }
}
public partial class DomainItem
{
public virtual string Workspace { get; set; }
public virtual string ObjectId { get; set; }
public virtual string VersionId { get; set; }
public virtual string LastUpdated { get; set; }
}
public partial class EventItem
{
public virtual string ObjectId { get; set; }
public virtual string Date { get; set; }
public virtual Location Location { get; set; }
public virtual string Barcode { get; set; }
public virtual string Details { get; set; }
public virtual string Type { get; set; }
public virtual bool IsScan { get; set; }
public virtual string User { get; set; }
public virtual string SelectedBy { get; set; }
public virtual string Status { get; set; }
public virtual string StatusType { get; set; }
public virtual string DateCreated { get; set; }
public virtual bool Automatic { get; set; }
}
public partial class Location
{
public virtual double y { get; set; }
public virtual double x { get; set; }
}
}
namespace Field2Office.API.Model.Contacts
{
///<summary>
///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
///</summary>
public partial class Contact
{
public Contact()
{
ServiceAddresses = new List<Address>{};
Documents = new List<DomainItem>{};
Data = new Dictionary<string, string>{};
Tasks = new List<string>{};
Assets = new List<string>{};
Contacts = new List<string>{};
Events = new List<EventItem>{};
Teams = new List<string>{};
ActiveLaborTypes = new Dictionary<string, Object>{};
}
public virtual string Workspace { get; set; }
public virtual string ObjectId { get; set; }
public virtual string TimeZone { get; set; }
public virtual string VersionId { get; set; }
public virtual string BasedOn { get; set; }
public virtual string ExternalId { get; set; }
public virtual string ContactName { get; set; }
public virtual string Company { get; set; }
public virtual string MobilePhone { get; set; }
public virtual string WorkPhone { get; set; }
public virtual string HomePhone { get; set; }
public virtual string Email { get; set; }
public virtual bool SMS { get; set; }
public virtual Address Address { get; set; }
public virtual bool Enabled { get; set; }
public virtual bool POI { get; set; }
public virtual bool EmailSiteDriving { get; set; }
public virtual List<Address> ServiceAddresses { get; set; }
public virtual List<DomainItem> Documents { get; set; }
public virtual Dictionary<string, string> Data { get; set; }
public virtual ClassedItem Owner { get; set; }
public virtual List<string> Tasks { get; set; }
public virtual List<string> Assets { get; set; }
public virtual List<string> Contacts { get; set; }
public virtual List<EventItem> Events { get; set; }
public virtual List<string> Teams { get; set; }
public virtual string Created { get; set; }
public virtual string LastUpdated { get; set; }
public virtual string CreatedBy { get; set; }
public virtual Dictionary<string, Object> ActiveLaborTypes { get; set; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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/csv
Content-Type: text/csv
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":{}}}