In order to use Voximplant SDK for the .NET, you need the following:
- A developer account. If you don't have one, sign up here.
- A private API key. There are 2 options to obtain it:
- Either generate it in the Voximplant Control panel
- Or call the CreateKey HTTP API method with the specified authentication parameters. You'll receive a response with the result field in it. Save the result value in a file (since we don't store the keys, save it securely on your side).
-
The best way to start is to use
NuGet
to add the SDK to your Solution:nuget install Voximplant.API
-
Next, specify the path to the JSON service account file either with the ClientConfig file or using the environment.
ClientConfig:
var config = new ClientConfiguration { KeyFile = "/path/to/credentials.json" }; var api = new VoximplantAPI(config);
Environment:
export VOXIMPLANT_CREDENTIALS=/path/to/credentials.json
This example shows how you can use the API client.
using System;
using Voximplant.API;
namespace example
{
class Program
{
private static void Main(string[] args)
{
try {
var voximplant = new VoximplantAPI();
var result = voximplant.GetSubscriptionPrice().Result;
Console.WriteLine($"Response: {result.ToString()}");
} catch (Exception e) {
Console.WriteLine($"Error: {e.Message}");
}
}
}
}