Field Squared API Services

<back to all web services

Route

Contains the data for a route within the system.

The following routes are available for this service:
GET,POST,DELETE/{Workspace}/Route/{ObjectId}
GET/{Workspace}/Route/{UserId}/{Date}

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

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

export class ClassedItem
{
    public ObjectId: string;
    public Class: string;
    public VersionId: string;
    public Ancestors: string[];
    public Type: string;

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

export class Schedule
{
    public Workspace: string;
    public ObjectId: string;
    public VersionId: string;
    public BasedOn: string;
    public Start: string;
    public End: string;
    public TimeZone: string;
    public Users: string[];
    public Teams: string[];
    public Data: { [index: string]: Object; };

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

export class RouteNode extends ClassedItem
{
    public Location: Location;
    public StopTime: number;
    public Schedule: Schedule;
    public Name: string;

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

export class RouteSegment
{
    public Time: number;
    public Distance: number;
    public Start: string;
    public End: string;
    public Geometry: Location[];
    public DrivingDirections: string[];
    public EndNode: RouteNode;

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

/** @description Contains the data for a route within the system. */
export class Route
{
    public Workspace: string;
    public AssignedWorkspace: string;
    public ObjectId: string;
    public VersionId: string;
    public BasedOn: string;
    public Created: string;
    public LastUpdated: string;
    public Date: string;
    public StartTime: string;
    public EndTime: string;
    public UserId: string;
    public Name: string;
    public Type: string;
    public Segments: RouteSegment[];
    public TotalTime: number;
    public TotalDistance: number;
    public Nodes: RouteNode[];

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

TypeScript Route 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.

POST /{Workspace}/Route/{ObjectId} HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Workspace: String,
	AssignedWorkspace: String,
	ObjectId: String,
	VersionId: String,
	BasedOn: String,
	Created: String,
	LastUpdated: String,
	Date: String,
	StartTime: String,
	EndTime: String,
	UserId: String,
	Name: String,
	Type: String,
	Segments: 
	[
		{
			Time: 0,
			Distance: 0,
			Start: String,
			End: String,
			Geometry: 
			[
				{
					y: 0,
					x: 0
				}
			],
			DrivingDirections: 
			[
				String
			],
			EndNode: 
			{
				Location: 
				{
					y: 0,
					x: 0
				},
				StopTime: 0,
				Schedule: 
				{
					Workspace: String,
					ObjectId: String,
					VersionId: String,
					BasedOn: String,
					Start: String,
					End: String,
					TimeZone: String,
					Users: 
					[
						String
					],
					Teams: 
					[
						String
					],
					Data: 
					{
						String: {}
					}
				},
				Name: String,
				ObjectId: String,
				Class: String,
				VersionId: String,
				Ancestors: 
				[
					String
				],
				Type: String
			}
		}
	],
	TotalTime: 0,
	TotalDistance: 0,
	Nodes: 
	[
		{
			Location: 
			{
				y: 0,
				x: 0
			},
			StopTime: 0,
			Schedule: 
			{
				Workspace: String,
				ObjectId: String,
				VersionId: String,
				BasedOn: String,
				Start: String,
				End: String,
				TimeZone: String,
				Users: 
				[
					String
				],
				Teams: 
				[
					String
				],
				Data: 
				{
					String: {}
				}
			},
			Name: String,
			ObjectId: String,
			Class: String,
			VersionId: String,
			Ancestors: 
			[
				String
			],
			Type: String
		}
	]
}