| POST | /{Workspace}/Track/{UserId} |
|---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using Field2Office.API.Model.Tracks;
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 Location
{
public virtual double y { get; set; }
public virtual double x { get; set; }
}
}
namespace Field2Office.API.Model.Tracks
{
///<summary>
///Service representing a RedlineItem object in a workspace.
///</summary>
public partial class RedlineItem
{
public virtual string PT { get; set; }
public virtual int Int { get; set; }
public virtual double Avg { get; set; }
}
///<summary>
///Service representing a StopItem object in a workspace.
///</summary>
public partial class StopItem
{
public virtual string PT { get; set; }
public virtual int Int { get; set; }
}
///<summary>
///Service representing a Track object in a workspace. Note that request.TrackId is returned on successful POST else null. The Items property is a list of Item objects, each object representing a location where the user stopped for a period of time. The Item object is comprised of a Location property (Lat/Lon), Time property (Timestamp in UTC string format) and Interval Property (Time stopped in seconds). The RedlineItems property is a list of RedlineItem objects, each object representing a location where the user began exceeding the redline speed defined in the workspace for a period of time also defined in the workspace. The properties are identical to the StopItem object, however the Interval property represents time spent above the redline speed in seconds. Speed property is in meters per sec.
///</summary>
public partial class Track
{
public Track()
{
Items = new List<string>{};
Stops = new List<StopItem>{};
Spd = new List<RedlineItem>{};
}
public virtual string Workspace { get; set; }
public virtual string UserId { get; set; }
public virtual string TrackId { get; set; }
public virtual List<string> Items { get; set; }
public virtual List<StopItem> Stops { get; set; }
public virtual List<RedlineItem> Spd { get; set; }
public virtual Address Address { get; set; }
public virtual double Distance { get; set; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /{Workspace}/Track/{UserId} HTTP/1.1
Host: dev.fieldsquared.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Workspace: String,
UserId: String,
TrackId: String,
Items:
[
String
],
Stops:
[
{
PT: String,
Int: 0
}
],
Spd:
[
{
PT: String,
Int: 0,
Avg: 0
}
],
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
},
Distance: 0
}