Infoset 1.0.0
dotnet add package Infoset --version 1.0.0
NuGet\Install-Package Infoset -Version 1.0.0
<PackageReference Include="Infoset" Version="1.0.0" />
paket add Infoset --version 1.0.0
#r "nuget: Infoset, 1.0.0"
// Install Infoset as a Cake Addin #addin nuget:?package=Infoset&version=1.0.0 // Install Infoset as a Cake Tool #tool nuget:?package=Infoset&version=1.0.0
Overview
This library allows you to quickly and easily use the Infoset Web API v1 via C# with .NET.
We appreciate your help and support, so please open issues if you see something that's not right, and open pull requests for bug fixes and improvements. Thank you!
Table of Contents
Installation
Prerequisites
- .NET version 4.5.2 and higher
- .NET Core 1.0 and higher
- .NET Standard 1.3 support
- An Infoset account, check out our pricing and sign up for free if you want to grow your business with Infoset
Obtain an API Key
Go to the API
tab on the General Settings
page on Infoset Dashboard to get your API key.
Setup Environment Variables to Manage Your API Key
Manage your Infoset API keys by storing them in Environment Variables or in Web.config. It is a good practice to keep your data and configuration settings separate. This way to you can change your Infoset API key without changing your code. Also, we strongly advise against storing sensitive data directly in your code.
Setup Environment Variables using the UI:
- Press Win+R and run SystemPropertiesAdvanced
- Click on Environment Variables
- Click New in user variables section
- Type INFOSET_API_KEY in the name. (Make sure this name matches the name of key in your code)
- Type actual API Key in the value
- Restart the IDE and you're done!
Setup Environment Variables using CMD:
- Run CMD as administrator
- setx INFOSET_API_KEY "YOUR_API_KEY"
Here are few example to get and set API Keys programatically:
Get Environment Variable
var apiKey = Environment.GetEnvironmentVariable("INFOSET_API_KEY");
Set Environment Variable
var setKey = Environment.SetEnvironmentVariable("INFOSET_API_KEY", "YOUR_API_KEY");
Install Package
To use Infoset in your C# project, either get the source code and build the package, or grab it automatically with NuGet package manager:
PM> Install-Package Infoset
Once you have the Infoset library installed, you can include calls to them in your code. For a sample implementation, see the .NET Example folder.
Dependencies
- Please see the .csproj file.
Quick Start
The following is the minimum needed code to send a simple request. Use this example, and modify the apiKey
variable:
using Infoset;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Example
{
internal class Example
{
private static void Main()
{
Execute().Wait();
}
static async Task Execute()
{
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_INFOSET_KEY");
string data = @"{'apikey':'" + apiKey + "', 'responseFormat':0}";
Object json = JsonConvert.DeserializeObject<Object>(data);
var options = new InfosetClientOptions
{
// ReliabilitySettings = new ReliabilitySettings(1, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(1)),
Host = "https://dashboard.infoset.app/api/",
Version = "v1/wsConnect.asmx"
};
var client = new InfosetClient(apiKey, options.Host, null, options.Version);
var response = await client.RequestAsync(InfosetClient.Method.POST, json.ToString(), urlPath: "getAccountId");
var ds_response = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(response.Body.ReadAsStringAsync().Result);
var statusCode = response.StatusCode;
var result = response.Body.ReadAsStringAsync().Result;
}
}
}
After executing the above code, statusCode
should be 200
and result
should contain your Account ID.
You can see all available functions and their parameters here.
Web Proxy
var options = new InfosetClientOptions
{
// ReliabilitySettings = new ReliabilitySettings(1, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(1)),
Host = "https://dashboard.infoset.app/api/",
Version = "v1/wsConnect.asmx"
};
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_INFOSET_KEY");
var proxy = new WebProxy("http://proxy:1337");
var client = new InfosetClient(proxy, apiKey, options.Host, null, options.Version);
Usage
Roadmap
If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We would love to hear your feedback!
How to Contribute
We encourage contribution to our library (you might even score some nifty swag), please see our CONTRIBUTING guide for details.
Quick links:
Troubleshooting
Please see our troubleshooting guide for common library issues.
About
infoset-csharp is guided and supported by the Infoset Team.
Email the Infoset Team here in case of any assistance or queries.
infoset-csharp is maintained and funded by Infoset. The names and logos for infoset-csharp are trademarks of Infoset Ltd.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
.NETFramework 4.5
- Newtonsoft.Json (>= 12.0.2)
- System.Net.Http (>= 4.3.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 538 | 10/27/2019 |