Field Squared API Services

<back to all web services

TeamCurrentLocation

GET /{Workspace}/TeamCurrentLocation - Returns the current location of all users in the workspace, grouped by team.

The following routes are available for this service:
GET/{Workspace}/TeamCurrentLocation
import Foundation
import ServiceStack

/**
* GET /{Workspace}/TeamCurrentLocation - Returns the current location of all users in the workspace, grouped by team. 
*/
public class TeamCurrentLocation : Codable
{
    public var workspace:String
    public var teamLocations:[TeamLocation] = []

    required public init(){}
}

public class TeamLocation : Codable
{
    public var objectId:String
    public var userLocations:[UserCurrentLocation] = []

    required public init(){}
}

public class UserCurrentLocation : Location
{
    public var objectId:String
    public var timeStamp:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case objectId
        case timeStamp
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        objectId = try container.decodeIfPresent(String.self, forKey: .objectId)
        timeStamp = try container.decodeIfPresent(String.self, forKey: .timeStamp)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if objectId != nil { try container.encode(objectId, forKey: .objectId) }
        if timeStamp != nil { try container.encode(timeStamp, forKey: .timeStamp) }
    }
}

public class Location : Codable
{
    public var y:Double
    public var x:Double

    required public init(){}
}


Swift TeamCurrentLocation 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.

GET /{Workspace}/TeamCurrentLocation HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: text/jsv