DocSpace.API.SDK
3.6.0
dotnet add package DocSpace.API.SDK --version 3.6.0
NuGet\Install-Package DocSpace.API.SDK -Version 3.6.0
<PackageReference Include="DocSpace.API.SDK" Version="3.6.0" />
<PackageVersion Include="DocSpace.API.SDK" Version="3.6.0" />
<PackageReference Include="DocSpace.API.SDK" />
paket add DocSpace.API.SDK --version 3.6.0
#r "nuget: DocSpace.API.SDK, 3.6.0"
#:package DocSpace.API.SDK@3.6.0
#addin nuget:?package=DocSpace.API.SDK&version=3.6.0
#tool nuget:?package=DocSpace.API.SDK&version=3.6.0
DocSpace.API.SDK
The ONLYOFFICE DocSpace SDK for C# is a library that provides tools for integrating and managing DocSpace features within your applications. It simplifies interaction with the DocSpace API by offering ready-to-use methods and models.
For more information, please visit https://helpdesk.onlyoffice.com/hc/en-us
Installation
To get started, install the package from NuGet
dotnet add package DocSpace.API.SDK
Usage
To use the API client with a HTTP proxy, set up a System.Net.WebProxy as follows:
Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
Connections
Each API class (specifically the API client within it) will create an instance of HttpClient. This instance is used throughout the class lifecycle and is disposed of when the Dispose method is called.
To better manage connections, it is common practice to reuse the HttpClient and HttpClientHandler (see here for details). To use your own HttpClient instance, just pass it to the API class constructor:
HttpClientHandler yourHandler = new HttpClientHandler();
HttpClient yourHttpClient = new HttpClient(yourHandler);
var api = new RoomsApi(yourHttpClient, yourHandler);
If you want to use an HttpClient but do not have access to its handler (for example, when using IHttpClientFactory in the ASP.NET Core DI context), you can create and configure your HttpClient instance separately and then pass it to the API class constructor:
HttpClient yourHttpClient = new HttpClient();
var api = new RoomsApi(yourHttpClient);
If you want to use an HttpClient but do not have access to its handler (for example, when using IHttpClientFactory in the ASP.NET Core DI context), you can create and configure your HttpClient instance separately and then pass it to the API class constructor:
Here is an example of DI setup in a sample web project:
services.AddHttpClient<RoomsApi>(httpClient =>
new RoomsApi(httpClient));
Getting Started
Configuration config = new Configuration();
config.BasePath = "https://your-docspace.onlyoffice.com";
// Configure Bearer token for authorization: Bearer
config.AccessToken = "YOUR_BEARER_TOKEN";
// create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
HttpClient httpClient = new HttpClient();
HttpClientHandler httpClientHandler = new HttpClientHandler();
var apiInstance = new ApiKeysApi(httpClient, config, httpClientHandler);
var createApiKeyRequestDto = new CreateApiKeyRequestDto?(); // CreateApiKeyRequestDto? | The request parameters for creating a new API key. (optional)
try
{
// Create a user API key
ApiKeyResponseWrapper result = apiInstance.CreateApiKey(createApiKeyRequestDto);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ApiKeysApi.CreateApiKey: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
Documentation for Authorization
Authentication schemes defined for the API:
asc_auth_key
- Type: API key
- API key parameter name: asc_auth_key
- Location: Cookie
Basic
- Type: HTTP basic authentication
Bearer
- Type: Bearer Authentication
ApiKeyBearer
- Type: API key
- API key parameter name: ApiKeyBearer
- Location: HTTP header
OAuth2
- Type: OAuth
- Flow: accessCode
- Authorization URL: {{authBaseUrl}}/oauth2/authorize
- Token Url: {{authBaseUrl}}/oauth2/token
- Scopes:
- read: Read access to protected resources
- write: Write access to protected resources
OpenId
- Type: OpenId Connect
- OpenId Connect URL: {{authBaseUrl}}/.well-known/openid-configuration
x-signature
- Type: API key
- API key parameter name: x-signature
- Location: Cookie
Documentation for API Endpoints
Look at GitHub.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- JsonSubTypes (>= 2.0.1)
- Polly (>= 8.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Minor update