Skip to content

Nexosis/nexosisclient-net

Repository files navigation

Nexosis .NET API Client

Build status

Installation

You need to be using a project referencing .NET Standard (any version of .NET Core or .NET Framework 4.6.2 or above).

PM> Install-Package Nexosis.Api.Client 

Usage

The most basic thing you can do with the API is submit some data and ask for predictions all at once. This can be done if you have a CSV file with the following code:

   var client = new NexosisClient("YOUR API KEY HERE");
   using (var file = File.OpenText("C:\\path\\to\\file.csv"))
   {
       var dataSetName = "myfile";
       var data = await client.DataSets.Create(DataSet.From(dataSetname, file));
       var session = await client.Sessions.CreateForecast(Sessions.Forecast(dataSetName, DateTimeOffset.Parse("2017-03-25 -0:00"), DateTimeOffset.Parse("2017-04-25 -0:00"), ResultInterval.Day, "sales"));

       Console.WriteLine($"{session.Id}");
   }

For this to work, the CSV file must have a header with the names of the columns in the file. One of those must be named "timeStamp", and in this example, there is a second column named "sales".

Once the forecasting is complete, you will receive an email notification. Using the sessionId from above, you will want to get results with the following call:

    var results = await client.Sessions.GetResults(sessionId);
    // results has a .Data property with the forecast values

Issues

Create a new issue. Please include code to reproduce the error if possible.

Pull requests are welcome.