CogniteSdk.Protobuf 5.6.1

dotnet add package CogniteSdk.Protobuf --version 5.6.1
                    
NuGet\Install-Package CogniteSdk.Protobuf -Version 5.6.1
                    
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="CogniteSdk.Protobuf" Version="5.6.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CogniteSdk.Protobuf" Version="5.6.1" />
                    
Directory.Packages.props
<PackageReference Include="CogniteSdk.Protobuf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CogniteSdk.Protobuf --version 5.6.1
                    
#r "nuget: CogniteSdk.Protobuf, 5.6.1"
                    
#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.
#:package CogniteSdk.Protobuf@5.6.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CogniteSdk.Protobuf&version=5.6.1
                    
Install as a Cake Addin
#tool nuget:?package=CogniteSdk.Protobuf&version=5.6.1
                    
Install as a Cake Tool

<a href="https://cognite.com/"> <img src="./cognite_logo.png" alt="Cognite logo" title="Cognite" align="right" height="80" /> </a>

CogniteSdk for .NET

Build and Test codecov Nuget

CogniteSdk for .NET is a cross platform asynchronous SDK for accessing the Cognite Data Fusion API (v1) using .NET Standard 2.0 that works for all .NET implementations i.e both .NET Core and .NET Framework.

Unofficial: please note that this is an unofficial and community driven SDK. Feel free to open issues, or provide PRs if you want to improve the library.

The SDK may be used from both C# and F#.

  • C# SDK: The C# SDK is a fluent API using objects and method chaining. Errors will be raised as exceptions. The API is asynchronous and all API methods returns Task and is awaitable using async/await.

  • F# SDK: The F# API is written using plain asynchronous functions returning Task built on top of the Oryx HTTP handler library.

Supported Resources

  • Assets
  • TimeSeries & DataPoints
  • Events
  • Files
  • Raw
  • Sequences
  • Relationships
  • Annotations
  • 3D Models
  • 3D Files
  • 3D Asset Mapping
  • Data sets
  • Extractor Pipelines
  • Transformations
  • Labels
  • Token
  • Groups
  • Units
  • Data Models

Beta Resources

  • Subscriptions
  • Templates
  • Streams and Records

Alpha Resources

  • Simulators

Documentation

Installation

CogniteSdk is available as a NuGet package. To install:

Using Package Manager:

Install-Package CogniteSdk

Using .NET CLI:

dotnet add package CogniteSdk

Or directly in Visual Studio.

Quickstart

Requests to Cognite Data Fusion are authenticated as submitted by a client using OAuth2 tokens. There are several authentication flows available, check the Cognite Documentation for more details.

The SDK does not include any logic to fetch tokens from an Identity Provider. Instead, the SDK expects a valid token to be provided by the user. The SDK will then use this token to authenticate requests to CDF.

All SDK methods are called with a Client object. A valid client requires:

  • Project Name - the name of your CDF project e.g publicdata.
  • App ID - an identifier for your application. It is a free text string. Example: asset-hierarchy-extractor
  • Base URL - the base URL for the CDF API. Example: https://api.cognitedata.com
  • Bearer Token - valid OAuth2 token for the CDF project.
  • HTTP Client - The HttpClient that will be used for the remote connection. Having this separate from the SDK have many benefits like using e.g Polly for policy handling.

Here's a simple example of how to instantiate a client. For this example we're using Microsoft Authentication Library to fetch a token from Azure AD using client credentials flow, but any other method for fetching a token will work as well.

using CogniteSdk;
using Microsoft.Identity.Client;

var tenantId = Environment.GetEnvironmentVariable("TENANT_ID");
var clientId = Environment.GetEnvironmentVariable("CLIENT_ID");
var clientSecret = Environment.GetEnvironmentVariable("CLIENT_SECRET");
var cluster = Environment.GetEnvironmentVariable("CDF_CLUSTER");
var project = Environment.GetEnvironmentVariable("CDF_PROJECT");

var scopes = new List<string>{ $"https://{cluster}.cognitedata.com/.default" };

var app = ConfidentialClientApplicationBuilder
    .Create(clientId)
    .WithAuthority(AzureCloudInstance.AzurePublic, tenantId)
    .WithClientSecret(clientSecret)
    .Build();

var result = await app.AcquireTokenForClient(scopes).ExecuteAsync();
var accessToken = result.AccessToken;

var httpClient = new HttpClient();
var client = Client.Builder.Create(httpClient)
    .SetAppId("dotnet-sdk-client")
    .AddHeader("Authorization", $"Bearer {accessToken}")
    .SetProject(project)
    .SetBaseUrl(new Uri($"https://{cluster}.cognitedata.com"))
    .Build();

// your logic using the client
var query = new Assets.AssetQuery
{
    Filter = new Assets.AssetFilter { Name = assetName }
};
var result = await client.Assets.ListAsync(query);

NOTE: The example above does not handle token refresh. If you need to refresh tokens, you need to implement this yourself or use a library like Cognite Extractor Utils that handles this for you.

Examples

There are examples for both C# and F# in the Examples folder.

Developing

Dotnet Tools

A dotnet tools manifest is used to version tools used by this repo. Install these tools with:

dotnet tool restore

This will install Paket locally which is used for dependency management.

Dependencies

Dependencies for all projects are handled using Paket. To install dependencies:

dotnet paket install

This will install the main dependencies and sub-dependencies. The main dependencies are:

Running tests locally

To run the tests locally, you can use the following script:

sh ./test.sh

For this script, the following AAD environment variables need to be defined:

  • TEST_TENANT_ID_WRITE
  • TEST_CLIENT_ID_WRITE
  • TEST_CLIENT_SECRET_WRITE

You also need read credentials for the publicdata project:

  • TEST_TENANT_ID_READ
  • TEST_CLIENT_ID_READ
  • TEST_CLIENT_SECRET_READ

Code of Conduct

This project follows https://www.contributor-covenant.org, see our Code of Conduct.

License

Apache v2, see LICENSE.

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.  net9.0 was computed.  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. 
.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 CogniteSdk.Protobuf:

Package Downloads
Oryx.Cognite

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.6.1 1,052 1/19/2026
5.6.0 380 1/13/2026
5.5.0 2,599 12/1/2025
5.4.0 2,006 11/10/2025
5.3.0 7,618 8/25/2025
5.2.2 470 8/20/2025
5.2.1 622 8/13/2025
5.2.0 1,321 8/6/2025
5.1.0 599 7/31/2025
5.0.0 626 7/24/2025
4.17.1 2,183 6/3/2025
4.17.0 825 4/11/2025
4.16.0 398 4/4/2025
4.15.0 8,653 4/2/2025
4.14.0 3,097 3/20/2025
4.13.4 7,050 2/19/2025
4.13.3 5,660 2/12/2025
4.13.2 735 2/10/2025
4.13.1 1,535 2/4/2025
4.13.0 3,042 1/24/2025
Loading failed