Hierarchy (view full)

Constructors

  • 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' });
    • apiVersion: "v1" = 'v1'

    Returns default

Properties

authenticate: (() => Promise<undefined | string>) = ...
project: string

Accessors

Methods

  • 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

  • Lookup response metadata from an request using the response as the parameter

    const createdAsset = await client.assets.create([{ name: 'My first asset' }]);
    const metadata = client.getMetadata(createdAsset);

    Parameters

    • value: object

    Returns undefined | Metadata