Options
All
  • Public
  • Public/Protected
  • All
Menu

SDK client (beta)

For smooth transition between stable sdk and beta, you may create an alias "@cognite/sdk": "@cognite/sdk-beta@^<version>" in package.json The beta SDK exports the client with the same name as stable, meaning you don't need to change any imports.

import { CogniteClient } from '@cognite/sdk';

const client = new CogniteClient({ appId: 'YOUR APPLICATION NAME' });

// can also specify a base URL
const client = new CogniteClient({ ..., baseUrl: 'https://greenfield.cognitedata.com' });
param

Client options

Hierarchy

Index

Constructors

constructor

  • Create a new SDK client

    Parameters

    • options: ClientOptions

      Client options

      import { CogniteClient } from '@cognite/sdk';
      
      const client = new CogniteClient({ appId: 'YOUR APPLICATION NAME' });
      
      // can also specify a base URL
      const client = new CogniteClient({ ..., baseUrl: 'https://greenfield.cognitedata.com' });
      
    • Default value apiVersion: CogniteAPIVersion = "v1"

    Returns CogniteClient

Properties

Readonly project

project: string

Accessors

alerts

annotations

apiKeys

assetMappings3D

assets

containers

dataModels

datapoints

datasets

documents

entityMatching

events

files

files3D

geospatial

groups

instances

labels

login

logout

models3D

monitoringTasks

profiles

projects

raw

relationships

revisions3D

securityCategories

sequences

serviceAccounts

sessions

spaces

templates

timeseries

units

viewer3D

views

vision

Methods

authenticate

  • authenticate(): Promise<undefined | string>

delete

get

getBaseUrl

  • getBaseUrl(): string

getDefaultRequestHeaders

  • Returns the default HTTP request headers, including e.g. authentication headers that is included in all requests. Headers provided per-requests is not included in this list. This function is useful when constructing API requests outside the SDK.

    const customUrl = '...';
    const headers = client.getDefaultRequestHeaders();
    const result = await fetch(customUrl, { headers });
    

    Returns HttpHeaders

getMetadata

  • getMetadata(value: object): undefined | Metadata

patch

post

put

Static urlEncodeExternalId

  • urlEncodeExternalId(externalId: string): string