|
GettingStartedJava
Complete sample snippet for the .NET Forecasting Client
Featured Getting started with Java Forecasting ClientThis page details the usage of the Lokad Java Forecasting Client, a Java wrapper around the Lokad Forecasting API. Check the API page for in-depth explanations about the API concepts. Pre-requisiteGo to the download section and get the Java version of Lokad Forecasting Client. This SDK comes as zip archive containing:
You need to reference these both JARs in your Java project. Data caveats
Sample snippet for the Java Forecasting ClientThe C# code snippet below illustrate how to upload and retrieve forecasts. String apikey = "ENTER_YOUR_FORECASTING_KEY_HERE";
String endpoint = "http://api.lokad.com/rest/forecasting3";
//String endpoint = "http://sandbox-api.lokad.com/rest/forecasting3"; // sandbox
ForecastingClient client = new ForecastingClient(apikey, endpoint);
// Create a new dataset (no effect if it exists already)
Dataset container = new Dataset();
container.Name = "mydata";
container.Period = "week";
container.Horizon = 4;
client.InsertDataset(container);
// Update or Insert time-series
TimeSerie[] series = new TimeSerie[] { /* snipped */ };
client.UpsertTimeSeries(container.Name, series, false); // merge=false
String[] serieNames = new String[] { /* snipped */ };
// Wait until forecasts are ready, and then download forecasts
ForecastSerie[] forecasts = client.GetForecasts(container.Name, serieNames); }}}}
|
► Sign in to add a comment