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
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports Field2Office.API.Model.Users
Imports Field2Office.API.Model
Imports Field2Office.DomainObjects
Imports Field2Office.API.Model.Workspaces

Namespace Global

    Namespace Field2Office.API.Model

        Public Partial Class Address
            Public Overridable Property Street As String
            Public Overridable Property Unit As String
            Public Overridable Property City As String
            Public Overridable Property State As String
            Public Overridable Property Zip As String
            Public Overridable Property ContactTitle As String
            Public Overridable Property ContactName As String
            Public Overridable Property ContactPhone As String
            Public Overridable Property ContactEmail As String
            Public Overridable Property Location As Location
            Public Overridable Property SiteName As String
            Public Overridable Property GeocodeFailed As Boolean
            Public Overridable Property Country As String
        End Class

        Public Partial Class EventItem
            Public Overridable Property ObjectId As String
            Public Overridable Property [Date] As String
            Public Overridable Property Location As Location
            Public Overridable Property Barcode As String
            Public Overridable Property Details As String
            Public Overridable Property Type As String
            Public Overridable Property IsScan As Boolean
            Public Overridable Property User As String
            Public Overridable Property SelectedBy As String
            Public Overridable Property Status As String
            Public Overridable Property StatusType As String
            Public Overridable Property DateCreated As String
            Public Overridable Property Automatic As Boolean
        End Class

        Public Partial Class Location
            Public Overridable Property y As Double
            Public Overridable Property x As Double
        End Class

        Public Partial Class UIColumnPref
            Public Overridable Property Name As String
            Public Overridable Property Width As Double
        End Class
    End Namespace

    Namespace Field2Office.API.Model.Users

        Public Partial Class CustomSchedule
            Public Overridable Property [Date] As String
            Public Overridable Property Start As Integer
            Public Overridable Property [End] As Integer
            Public Overridable Property Type As String
        End Class

        '''<Summary>
        '''Represents a DTO for a user in a workspace. Calls without an ObjectId will retrieve an array of all user objects for the workspace.
        '''</Summary>
        Public Partial Class User
            Public Sub New()
                ProposedRoute = New List(Of Location)
                ActualRoute = New List(Of Location)
                Documents = New List(Of String)
                SkillTags = New List(Of String)
                UIPrefTaskColumnsOff = New List(Of String)
                UIPrefTaskColumns = New List(Of UIColumnPref)
                Data = New Dictionary(Of String, String)
                Teams = New List(Of String)
                Events = New List(Of EventItem)
                Assets = New List(Of String)
                WorkWeek = New List(Of WorkDay)
                CustomSchedules = New List(Of CustomSchedule)
            End Sub

            Public Overridable Property Workspace As String
            Public Overridable Property TimeZone As String
            Public Overridable Property ObjectId As String
            Public Overridable Property VersionId As String
            Public Overridable Property Created As String
            Public Overridable Property LastUpdated As String
            Public Overridable Property BasedOn As String
            Public Overridable Property ExternalId As String
            Public Overridable Property Name As String
            Public Overridable Property Initials As String
            Public Overridable Property Phone As String
            Public Overridable Property Email As String
            Public Overridable Property Password As String
            Public Overridable Property RequestUser As String
            Public Overridable Property Location As Location
            Public Overridable Property UserType As String
            Public Overridable Property ProposedRoute As List(Of Location)
            Public Overridable Property ActualRoute As List(Of Location)
            Public Overridable Property Image As String
            Public Overridable Property UserStatus As UserStatus
            Public Overridable Property RecordStatus As String
            Public Overridable Property Documents As List(Of String)
            Public Overridable Property SubscribeToEmails As Boolean
            Public Overridable Property Address As Address
            Public Overridable Property SkillTags As List(Of String)
            Public Overridable Property Enabled As Boolean
            Public Overridable Property UIPrefTaskColumnsOff As List(Of String)
            Public Overridable Property UIPrefTaskColumns As List(Of UIColumnPref)
            Public Overridable Property Data As Dictionary(Of String, String)
            Public Overridable Property Teams As List(Of String)
            Public Overridable Property Events As List(Of EventItem)
            Public Overridable Property Color As String
            Public Overridable Property VehicleAsset As String
            Public Overridable Property ExternalAuth As Boolean
            Public Overridable Property CreatedBy As String
            Public Overridable Property ServiceAccount As Boolean
            Public Overridable Property Assets As List(Of String)
            Public Overridable Property TfaRequired As Boolean
            Public Overridable Property TfaPreference As String
            Public Overridable Property WorkWeek As List(Of WorkDay)
            Public Overridable Property CustomSchedulesEnabled As Boolean
            Public Overridable Property CustomSchedules As List(Of CustomSchedule)
            Public Overridable Property OverrideSso As Boolean
        End Class

        '''<Summary>
        '''Bulk import a set of users.
        '''</Summary>
        Public Partial Class UserImport
            Public Sub New()
                Users = New List(Of User)
            End Sub

            Public Overridable Property Workspace As String
            Public Overridable Property Users As List(Of User)
            Public Overridable Property RequestId As String
        End Class
    End Namespace

    Namespace Field2Office.API.Model.Workspaces

        Public Partial Class WorkDay
            Public Overridable Property DayOfWeek As Integer
            Public Overridable Property Start As Integer
            Public Overridable Property [End] As Integer
            Public Overridable Property Lunch As Integer
        End Class
    End Namespace

    Namespace Field2Office.DomainObjects

        Public Enum UserStatus
            NotStarted
            Driving
            InProgress
            Complete
            Blocked
        End Enum
    End Namespace
End Namespace

VB.NET UserImport DTOs

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

HTTP + CSV

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: text/csv
Content-Type: text/csv
Content-Length: length

{"Workspace":"String","Users":[{"Workspace":"String","TimeZone":"String","ObjectId":"String","VersionId":"String","Created":"String","LastUpdated":"String","BasedOn":"String","ExternalId":"String","Name":"String","Initials":"String","Phone":"String","Email":"String","Password":"String","RequestUser":"String","Location":{"y":0,"x":0},"UserType":"String","ProposedRoute":[{"y":0,"x":0}],"ActualRoute":[{"y":0,"x":0}],"Image":"String","UserStatus":"NotStarted","RecordStatus":"String","Documents":["String"],"SubscribeToEmails":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"},"SkillTags":["String"],"Enabled":false,"UIPrefTaskColumnsOff":["String"],"UIPrefTaskColumns":[{"Name":"String","Width":0}],"Data":{"String":"String"},"Teams":["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}],"Color":"String","VehicleAsset":"String","ExternalAuth":false,"CreatedBy":"String","ServiceAccount":false,"Assets":["String"],"TfaRequired":false,"TfaPreference":"String","WorkWeek":[{"DayOfWeek":0,"Start":0,"End":0,"Lunch":0}],"CustomSchedulesEnabled":false,"CustomSchedules":[{"Date":"String","Start":0,"End":0,"Type":"String"}],"OverrideSso":false}],"RequestId":"String"}