Field Squared API Services

<back to all web services

UserImport

Bulk import a set of users.

The following routes are available for this service:
POST/{Workspace}/UserImport

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

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

export enum UserStatus
{
    NotStarted = 'NotStarted',
    Driving = 'Driving',
    InProgress = 'InProgress',
    Complete = 'Complete',
    Blocked = 'Blocked',
}

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 UIColumnPref
{
    public Name: string;
    public Width: number;

    public constructor(init?: Partial<UIColumnPref>) { (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); }
}

export class WorkDay
{
    public DayOfWeek: number;
    public Start: number;
    public End: number;
    public Lunch: number;

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

export class CustomSchedule
{
    public Date: string;
    public Start: number;
    public End: number;
    public Type: string;

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

/** @description Represents a DTO for a user in a workspace. Calls without an ObjectId will retrieve an array of all user objects for the workspace. */
export class User
{
    public Workspace: string;
    public TimeZone: string;
    public ObjectId: string;
    public VersionId: string;
    public Created: string;
    public LastUpdated: string;
    public BasedOn: string;
    public ExternalId: string;
    public Name: string;
    public Initials: string;
    public Phone: string;
    public Email: string;
    public Password: string;
    public RequestUser: string;
    public Location: Location;
    public UserType: string;
    public ProposedRoute: Location[];
    public ActualRoute: Location[];
    public Image: string;
    public UserStatus: UserStatus;
    public RecordStatus: string;
    public Documents: string[];
    public SubscribeToEmails: boolean;
    public Address: Address;
    public SkillTags: string[];
    public Enabled: boolean;
    public UIPrefTaskColumnsOff: string[];
    public UIPrefTaskColumns: UIColumnPref[];
    public Data: { [index: string]: string; };
    public Teams: string[];
    public Events: EventItem[];
    public Color: string;
    public VehicleAsset: string;
    public ExternalAuth: boolean;
    public CreatedBy: string;
    public ServiceAccount: boolean;
    public Assets: string[];
    public TfaRequired: boolean;
    public TfaPreference: string;
    public WorkWeek: WorkDay[];
    public CustomSchedulesEnabled: boolean;
    public CustomSchedules: CustomSchedule[];
    public OverrideSso: boolean;

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

/** @description Bulk import a set of users. */
export class UserImport
{
    public Workspace: string;
    public Users: User[];
    public RequestId: string;

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

TypeScript UserImport DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /{Workspace}/UserImport HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UserImport xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Users">
  <RequestId>String</RequestId>
  <Users>
    <User>
      <ActualRoute xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:Location>
          <d4p1:x>0</d4p1:x>
          <d4p1:y>0</d4p1:y>
        </d4p1:Location>
      </ActualRoute>
      <Address xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:City>String</d4p1:City>
        <d4p1:ContactEmail>String</d4p1:ContactEmail>
        <d4p1:ContactName>String</d4p1:ContactName>
        <d4p1:ContactPhone>String</d4p1:ContactPhone>
        <d4p1:ContactTitle>String</d4p1:ContactTitle>
        <d4p1:Country>String</d4p1:Country>
        <d4p1:GeocodeFailed>false</d4p1:GeocodeFailed>
        <d4p1:Location>
          <d4p1:x>0</d4p1:x>
          <d4p1:y>0</d4p1:y>
        </d4p1:Location>
        <d4p1:SiteName>String</d4p1:SiteName>
        <d4p1:State>String</d4p1:State>
        <d4p1:Street>String</d4p1:Street>
        <d4p1:Unit>String</d4p1:Unit>
        <d4p1:Zip>String</d4p1:Zip>
      </Address>
      <Assets xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </Assets>
      <BasedOn>String</BasedOn>
      <Color>String</Color>
      <Created>String</Created>
      <CreatedBy>String</CreatedBy>
      <CustomSchedules>
        <CustomSchedule>
          <Date>String</Date>
          <End>0</End>
          <Start>0</Start>
          <Type>String</Type>
        </CustomSchedule>
      </CustomSchedules>
      <CustomSchedulesEnabled>false</CustomSchedulesEnabled>
      <Data xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringstring>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value>String</d4p1:Value>
        </d4p1:KeyValueOfstringstring>
      </Data>
      <Documents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </Documents>
      <Email>String</Email>
      <Enabled>false</Enabled>
      <Events xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:EventItem>
          <d4p1:Automatic>false</d4p1:Automatic>
          <d4p1:Barcode>String</d4p1:Barcode>
          <d4p1:Date>String</d4p1:Date>
          <d4p1:DateCreated>String</d4p1:DateCreated>
          <d4p1:Details>String</d4p1:Details>
          <d4p1:IsScan>false</d4p1:IsScan>
          <d4p1:Location>
            <d4p1:x>0</d4p1:x>
            <d4p1:y>0</d4p1:y>
          </d4p1:Location>
          <d4p1:ObjectId>String</d4p1:ObjectId>
          <d4p1:SelectedBy>String</d4p1:SelectedBy>
          <d4p1:Status>String</d4p1:Status>
          <d4p1:StatusType>String</d4p1:StatusType>
          <d4p1:Type>String</d4p1:Type>
          <d4p1:User>String</d4p1:User>
        </d4p1:EventItem>
      </Events>
      <ExternalAuth>false</ExternalAuth>
      <ExternalId>String</ExternalId>
      <Image>String</Image>
      <Initials>String</Initials>
      <LastUpdated>String</LastUpdated>
      <Location xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:x>0</d4p1:x>
        <d4p1:y>0</d4p1:y>
      </Location>
      <Name>String</Name>
      <ObjectId>String</ObjectId>
      <OverrideSso>false</OverrideSso>
      <Password>String</Password>
      <Phone>String</Phone>
      <ProposedRoute xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:Location>
          <d4p1:x>0</d4p1:x>
          <d4p1:y>0</d4p1:y>
        </d4p1:Location>
      </ProposedRoute>
      <RecordStatus>String</RecordStatus>
      <RequestUser>String</RequestUser>
      <ServiceAccount>false</ServiceAccount>
      <SkillTags xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </SkillTags>
      <SubscribeToEmails>false</SubscribeToEmails>
      <Teams xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </Teams>
      <TfaPreference>String</TfaPreference>
      <TfaRequired>false</TfaRequired>
      <TimeZone>String</TimeZone>
      <UIPrefTaskColumns xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:UIColumnPref>
          <d4p1:Name>String</d4p1:Name>
          <d4p1:Width>0</d4p1:Width>
        </d4p1:UIColumnPref>
      </UIPrefTaskColumns>
      <UIPrefTaskColumnsOff xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </UIPrefTaskColumnsOff>
      <UserStatus>NotStarted</UserStatus>
      <UserType>String</UserType>
      <VehicleAsset>String</VehicleAsset>
      <VersionId>String</VersionId>
      <WorkWeek xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Workspaces">
        <d4p1:WorkDay>
          <d4p1:DayOfWeek>0</d4p1:DayOfWeek>
          <d4p1:End>0</d4p1:End>
          <d4p1:Lunch>0</d4p1:Lunch>
          <d4p1:Start>0</d4p1:Start>
        </d4p1:WorkDay>
      </WorkWeek>
      <Workspace>String</Workspace>
    </User>
  </Users>
  <Workspace>String</Workspace>
</UserImport>