Net.RestSharp
Name | EmbyClient.Dotnet |
---|---|
Language | C# |
SDK Folder | SampleCode/RestApi/Clients/Net.RestSharp |
Prerequisites
Frameworks supported
- .NET >=5.0
- .NET Core >=2.0
- .NetStandard 2.0
- .NET Framework >=4.6
- Mono/Xamarin
- UWP >=10.0
Dependencies
Note
RestSharp has introduced breaking changes in v107.x. Updating RestSharp to those version will require a huge amount of changes to the code.
Getting Started
Using the Client Code
The Net.RestSharp\EmbyClient.Dotnet
folder includes the C# project EmbyClient.Dotnet.csproj
and all code that is required. You can copy the whole folder directly into your own project.
Visal Studio Sample Application
The folder includes a Visual Studio solution which you can open directly in Visual Studio 2019 (or later).
The sample application is a simple Windows Forms application which demonstrates how to authenticate with Emby Server and make basic API calls:
Basic Code Example
using System;
using System.Diagnostics;
using EmbyClient.Dotnet.Api;
using EmbyClient.Dotnet.Client;
using EmbyClient.Dotnet.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure API key authorization: apikeyauth
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
var apiInstance = new ActivityLogServiceApi();
var startIndex = 56; // int? | Optional. The record index to start at. All items with a lower index will be dropped from the results. (optional)
var limit = 56; // int? | Optional. The maximum number of records to return (optional)
var minDate = minDate_example; // string | Optional. The minimum date. Format = ISO (optional)
try
{
// Gets activity log entries
QueryResultActivityLogEntry result = apiInstance.GetSystemActivitylogEntries(startIndex, limit, minDate);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ActivityLogServiceApi.GetSystemActivitylogEntries: " + e.Message );
}
}
}
}
Documentation Links
For general documentation, please refer to Accessing Emby Server via REST API.
The available API endpoints are documented in the REST API Reference section.