SynologyDotNet.Core 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SynologyDotNet.Core --version 0.3.0
NuGet\Install-Package SynologyDotNet.Core -Version 0.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SynologyDotNet.Core" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SynologyDotNet.Core --version 0.3.0
#r "nuget: SynologyDotNet.Core, 0.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SynologyDotNet.Core as a Cake Addin
#addin nuget:?package=SynologyDotNet.Core&version=0.3.0

// Install SynologyDotNet.Core as a Cake Tool
#tool nuget:?package=SynologyDotNet.Core&version=0.3.0

SynologyDotNet.Core

Base library to develop .NET clients for Synology DSM.

  • Target: .NET Standard 2.0, so it works with a wide range of .NET versions.
  • This is a small framework to consume Synology DSM's Web API
  • Supports HTTP and HTTPS
  • SSL certificate validation can be disabled (only for SynoClient, does not affect the AppDomain)

Usage examples

Basic example with one client

In order to consume data, you may also add other NuGet packages like SynologyDotNet.AudioStation. This example shows how to configure the connection and login with username and password.

// Create an AudioStationClient
var audioStation = new AudioStationClient();

// Create the SynoClient which communicates with the server, this can be re-used across all Station Clients.
var client = new SynoClient(new Uri("https://MySynolgyNAS:5001/"), audioStation);

// Login
await _synoClient.LoginAsync("username", "password");

// Get 100 artists from the music library.
var response = await audioStation.ListArtistsAsync(100, 0);
foreach(var artist in response.Data.Artists)
    Console.WriteLine(artist.Name);

Login by re-using previous session

SynoClient supports re-using sessions. This is possible if you didn't call the LogoutAsync function and you saved the session returned from LoginAsync function like this:

if(synoSession is null)
    synoSession = await _synoClient.LoginAsync("username", "password");
else
    await _synoClient.LoginWithPreviousSessionAsync(synoSession);

The LoginWithPreviousSessionAsync function will perform a test by default to validate the session, but this can be disabled optionally if you want to save one request.

    await _synoClient.LoginWithPreviousSessionAsync(synoSession, false);

If you make a request anyway after login to fetch your data, this is the recommended approach.

Notes

This is one of my home projects. My goal is to develop my own library and build applications on top of them. It can be useful for others too, so I decided to go open-source and publish my packages.

Always make backups. I am not responsible for any data loss.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SynologyDotNet.Core:

Package Downloads
SynologyDotNet.AudioStation

SynologyDotNet.AudioStation

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.0 572 7/31/2022
0.4.3 481 12/27/2021
0.4.2 319 12/24/2021
0.4.1 342 12/19/2021
0.4.0 244 12/13/2021
0.3.0 376 12/1/2021