Moesif.Api 1.1.1

Injest API Calls into Moesif for Root Cause Analysis

There is a newer version of this package available.
See the version list below for details.
Install-Package Moesif.Api -Version 1.1.1
dotnet add package Moesif.Api --version 1.1.1
<PackageReference Include="Moesif.Api" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Moesif.Api --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MoesifApi Lib for C#

Source Code on GitHub

Nuget Package

Check out Moesif's Developer Documentation and C# API Reference to learn more

How to Install:

Install the Nuget Package:

	Install-Package Moesif.Api

How to Use:

using System;
using System.Collections.Generic;
using Moesif.Api;
using Moesif.Api.Models;
using Moesif.Api.Exceptions;
using Moesif.Api.Controllers;
using System.Threading.Tasks;

// Create client instance using your ApplicationId
var client = new MoesifApiClient("my_application_id");
var apiClient = client.Api;

// Parameters for the API call
var reqHeaders = new Dictionary<string, string>();
reqHeaders.Add("Host", "api.acmeinc.com");
reqHeaders.Add("Accept", "*/*");
reqHeaders.Add("Connection", "Keep-Alive");
reqHeaders.Add("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)");
reqHeaders.Add("Content-Type", "application/json");
reqHeaders.Add("Content-Length", "126");
reqHeaders.Add("Accept-Encoding", "gzip");

var reqBody = ApiHelper.JsonDeserialize<object>(@" {
	    ""items"": [
		    {
			    ""type"": 1,
			    ""id"": ""fwfrf""
	},
		    {
			    ""type"": 2,
			    ""id"": ""d43d3f""
		    }
	    ]
    }");

var rspHeaders = new Dictionary<string, string>();
rspHeaders.Add("Date", "Tue, 23 Nov 2016 23:46:49 GMT");
rspHeaders.Add("Vary", "Accept-Encoding");
rspHeaders.Add("Pragma", "no-cache");
rspHeaders.Add("Expires", "-1");
rspHeaders.Add("Content-Type", "application/json; charset=utf-8");
rspHeaders.Add("Cache-Control", "no-cache");

var rspBody = ApiHelper.JsonDeserialize<object>(@" {
	    ""Error"": ""InvalidArgumentException"",
	    ""Message"": ""Missing field field_a""
    }");


var eventReq = new EventRequestModel()
{
Time = DateTime.Now.AddSeconds(-1),
Uri = "https://api.acmeinc.com/items/reviews/",
Verb = "PATCH",
ApiVersion = "1.1.0",
IpAddress = "61.48.220.123",
Headers = reqHeaders,
Body = reqBody
};

var eventRsp = new EventResponseModel()
{
Time = DateTime.Now,
Status = 500,
Headers = rspHeaders,
Body = rspBody
};

Dictionary<string, string> metadata = new Dictionary<string, string>
	{
		{ "email", "abc@email.com" },
		{ "name", "abcdef" },
		{ "image", "123" }
	};

var eventModel = new EventModel()
{
Request = eventReq,
Response = eventRsp,
UserId = "my_user_id",
SessionToken = "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
Metadata = metadata
};

// Perform API call

try
{
await apiClient.CreateEventAsync(eventModel);
}
catch(APIException) {};

Update User:

The api also let you update a user profile with custom metadata. The UserId is a required field, all other fields are optional.

Dictionary<string, object> metadata = new Dictionary<string, object>
{
	{"email", "johndoe@acmeinc.com"},
	{"string_field", "value_1"},
	{"number_field", 0},
	{"object_field", new Dictionary<string, string> {
		{"field_a", "value_a"},
		{"field_b", "value_b"}
		}
	}
};

var userModel = new UserModel()
{
	UserAgentString = "Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)",
	UserId = "my_user_id",
	Metadata = metadata,
	ModifiedTime = DateTime.UtcNow
};

// Perform API call
try
{
	// Create client instance using your ApplicationId
	var client = new MoesifApiClient("my_application_id");
	var apiClient = client.Api;
	apiClient.UpdateUserAsync(userModel);
}
catch (APIException) { };

How To Test:

The SDK also contain tests, which are contained in the Moesif.Api.Tests project.
In order to invoke these test cases, you will need NUnit 3.0 Test Adapter Extension for Visual Studio.
Once the SDK is complied, the test cases should appear in the Test Explorer window.
Here, you can click Run All to execute these test cases.

Compatibility:

The build process generates a portable class library, which can be used like
a normal class library. The generated library is compatible with Windows Forms,
Windows RT, Windows Phone 8, Silverlight 5, Xamarin iOS, Xamarin Android and
Mono. More information on how to use can be found at the following link.

http://msdn.microsoft.com/en-us/library/vstudio/gg597391(v=vs.100).aspx

MoesifApi Lib for C#

Source Code on GitHub

Nuget Package

Check out Moesif's Developer Documentation and C# API Reference to learn more

How to Install:

Install the Nuget Package:

	Install-Package Moesif.Api

How to Use:

using System;
using System.Collections.Generic;
using Moesif.Api;
using Moesif.Api.Models;
using Moesif.Api.Exceptions;
using Moesif.Api.Controllers;
using System.Threading.Tasks;

// Create client instance using your ApplicationId
var client = new MoesifApiClient("my_application_id");
var apiClient = client.Api;

// Parameters for the API call
var reqHeaders = new Dictionary<string, string>();
reqHeaders.Add("Host", "api.acmeinc.com");
reqHeaders.Add("Accept", "*/*");
reqHeaders.Add("Connection", "Keep-Alive");
reqHeaders.Add("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)");
reqHeaders.Add("Content-Type", "application/json");
reqHeaders.Add("Content-Length", "126");
reqHeaders.Add("Accept-Encoding", "gzip");

var reqBody = ApiHelper.JsonDeserialize<object>(@" {
	    ""items"": [
		    {
			    ""type"": 1,
			    ""id"": ""fwfrf""
	},
		    {
			    ""type"": 2,
			    ""id"": ""d43d3f""
		    }
	    ]
    }");

var rspHeaders = new Dictionary<string, string>();
rspHeaders.Add("Date", "Tue, 23 Nov 2016 23:46:49 GMT");
rspHeaders.Add("Vary", "Accept-Encoding");
rspHeaders.Add("Pragma", "no-cache");
rspHeaders.Add("Expires", "-1");
rspHeaders.Add("Content-Type", "application/json; charset=utf-8");
rspHeaders.Add("Cache-Control", "no-cache");

var rspBody = ApiHelper.JsonDeserialize<object>(@" {
	    ""Error"": ""InvalidArgumentException"",
	    ""Message"": ""Missing field field_a""
    }");


var eventReq = new EventRequestModel()
{
Time = DateTime.Now.AddSeconds(-1),
Uri = "https://api.acmeinc.com/items/reviews/",
Verb = "PATCH",
ApiVersion = "1.1.0",
IpAddress = "61.48.220.123",
Headers = reqHeaders,
Body = reqBody
};

var eventRsp = new EventResponseModel()
{
Time = DateTime.Now,
Status = 500,
Headers = rspHeaders,
Body = rspBody
};

Dictionary<string, string> metadata = new Dictionary<string, string>
	{
		{ "email", "abc@email.com" },
		{ "name", "abcdef" },
		{ "image", "123" }
	};

var eventModel = new EventModel()
{
Request = eventReq,
Response = eventRsp,
UserId = "my_user_id",
SessionToken = "23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
Metadata = metadata
};

// Perform API call

try
{
await apiClient.CreateEventAsync(eventModel);
}
catch(APIException) {};

Update User:

The api also let you update a user profile with custom metadata. The UserId is a required field, all other fields are optional.

Dictionary<string, object> metadata = new Dictionary<string, object>
{
	{"email", "johndoe@acmeinc.com"},
	{"string_field", "value_1"},
	{"number_field", 0},
	{"object_field", new Dictionary<string, string> {
		{"field_a", "value_a"},
		{"field_b", "value_b"}
		}
	}
};

var userModel = new UserModel()
{
	UserAgentString = "Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)",
	UserId = "my_user_id",
	Metadata = metadata,
	ModifiedTime = DateTime.UtcNow
};

// Perform API call
try
{
	// Create client instance using your ApplicationId
	var client = new MoesifApiClient("my_application_id");
	var apiClient = client.Api;
	apiClient.UpdateUserAsync(userModel);
}
catch (APIException) { };

How To Test:

The SDK also contain tests, which are contained in the Moesif.Api.Tests project.
In order to invoke these test cases, you will need NUnit 3.0 Test Adapter Extension for Visual Studio.
Once the SDK is complied, the test cases should appear in the Test Explorer window.
Here, you can click Run All to execute these test cases.

Compatibility:

The build process generates a portable class library, which can be used like
a normal class library. The generated library is compatible with Windows Forms,
Windows RT, Windows Phone 8, Silverlight 5, Xamarin iOS, Xamarin Android and
Mono. More information on how to use can be found at the following link.

http://msdn.microsoft.com/en-us/library/vstudio/gg597391(v=vs.100).aspx

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Moesif.Api:

Package Downloads
Moesif.Azure.Web.Logging
IIS Module for logging API calls to Moesif
Moesif.Middleware
.NET Middleware to log API Calls to Moesif API Analytics and Monitoring
Moesif.Azure.Apps
Leverage user-centric API analytics to drive adoption, usage, and retention, including: - Gain visibility into API adoption and usage - Quickly debug functional and performance issues - Monitor for issues impacting customers - Create live dashboards and share with colleagues - Embed API logs in your app to help customers onboard quickly Native support for REST, GraphQL, Web3, and others

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.1 152 6/15/2020
2.0.0 84 6/11/2020
1.1.9 278 12/19/2019
1.1.7 118 12/13/2019
1.1.6 133 11/15/2019
1.1.5 186 8/22/2019
1.1.4 350 2/22/2019
1.1.3 188 2/16/2019
1.1.2 230 2/9/2019
1.1.1 296 11/1/2018
1.1.0 237 10/23/2018
1.0.6 1,322 2/12/2018
Show less