PlanSolve is still in pre-alpha – Features may change or break. Feedback welcome!
Field Service .NET SDK
A native .NET client library specifically for PlanSolve field service optimization. Built with modern C# features and async/await patterns for optimal performance in field operations.
Installation
📦
NuGet Package Manager
Install-Package PlanSolve🔧
dotnet CLI
dotnet add package PlanSolveQuick Start - Field Service
Get started with field service optimization in minutes. This example shows how to optimize technician routes and schedule customer visits using C#.
using PlanSolve;
var planSolve = new PlanSolveClient("YOUR_API_KEY");
// Create vehicles (field technicians)
var vehicles = new List<Vehicle>
{
new Vehicle
{
Id = "tech1",
HomeLocation = new double[] { 40.7128, -74.0060 }, // NYC coordinates
Shifts = new List<Shift>
{
new Shift
{
Id = "morning-shift",
MinStartTime = "2024-01-15T08:00:00",
MaxEndTime = "2024-01-15T17:00:00"
}
},
Skills = new List<string> { "repair", "installation" }
}
};
// Create visits (customer appointments)
var visits = new List<Visit>
{
new Visit
{
Id = "visit1",
Name = "Times Square Repair",
Location = new double[] { 40.7589, -73.9851 },
TimeWindows = new List<TimeWindow>
{
new TimeWindow
{
MinStartTime = "2024-01-15T09:00:00",
MaxEndTime = "2024-01-15T17:00:00"
}
},
ServiceDuration = "PT30M",
Priority = "HIGH",
RequiredSkills = new List<string> { "repair" }
}
};
// Create the optimization request
var request = new FieldServiceStartRequest
{
SouthWestCorner = new double[] { 40.74, -74.01 },
NorthEastCorner = new double[] { 40.76, -73.98 },
StartDateTime = "2024-01-15T08:00:00",
EndDateTime = "2024-01-15T18:00:00",
Vehicles = vehicles,
Visits = visits
};
try
{
// Start the optimization
var response = await planSolve.FieldService.StartAsync(request);
Console.WriteLine($"Optimization started! Job ID: {response.JobId}");
// Get results
var result = await planSolve.FieldService.GetResultAsync(response.JobId);
Console.WriteLine("Optimization completed!", result);
}
catch (Exception ex)
{
Console.WriteLine($"Optimization failed: {ex.Message}");
}Field Service API Reference
FieldService
Handles field service optimization requests and results.
Methods
StartAsync(request: FieldServiceStartRequest)- Start a new field service optimizationGetResultAsync(jobId: string)- Get the completed optimization result
Data Models
Key data structures for field service optimization.
Vehicle
public class Vehicle
{
public string Id { get; set; }
public double[] HomeLocation { get; set; }
public List<Shift> Shifts { get; set; }
public List<string> Skills { get; set; }
}Visit
public class Visit
{
public string Id { get; set; }
public string Name { get; set; }
public double[] Location { get; set; }
public List<TimeWindow> TimeWindows { get; set; }
public string ServiceDuration { get; set; }
public string Priority { get; set; }
public List<string> RequiredSkills { get; set; }
}Ready to Optimize Field Service?
Start integrating field service optimization into your .NET applications today.