A client written in .NET/C# for the Synology API - https://www.synology.com/en-us/support/developer#tool
I've only implemented the endpoints that I'm currently using but please feel free to request changes or submit contributions.
const string dsmUrl = "http://192.168.0.1:5001/";
var client = new SynologyClient(dsmUrl);
// Retrieve all API description objects
var apiInfo = await client.InfoApi().QueryAsync();
// Authenticate
await client.LoginAsync("username", "password");
// List all shares
var shares = await client.FileStationApi().ListEndpoint().ListSharesAsync();
// Upload file
var uploadResult = await client.FileStationApi().UploadEndpoint().UploadAsync("path_to_file", "destination");
// End session
await client.LogoutAsync(session);| SYNO.API | Methods |
|---|---|
| Auth | login logout |
| Info | query |
| SYNO.FileStation | Methods |
|---|---|
| List | list list_share |
| Search | start list |
| Upload | upload |
| CopyMove | start status stop |
| CreateFolder | create |
| Extract | start status stop list |
| SYNO.DownloadStation | Methods |
|---|---|
| Info | Info GetConfig SetServerConfig |
| Task | List Create Delete Pause Resume |
You need to inject your own HttpClient with a modified HttpClientHandler.
const string dsmUrl = "http://192.168.0.1:5001/";
var handler = new HttpClientHandler();
//This disables all certificate validation. It is not recommended (especially in production)!
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true;
var httpClient = new HttpClient(handler);
var client = new SynologyClient(dsmUrl, httpClient);