Skip to main content
POST
/
models
/
views
Python SDK
from cognite.client.data_classes.data_modeling import ViewApply, MappedPropertyApply, ContainerId
views = [
    ViewApply(
        space="mySpace",
        external_id="myView",
        version="v1",
        properties={
            "someAlias": MappedPropertyApply(
                container=ContainerId("mySpace", "myContainer"),
                container_property_identifier="someProperty",
            ),
        }
   )
]
res = client.data_modeling.views.apply(views)

from cognite.client.data_classes.data_modeling import (
    ContainerId,
    DirectRelationReference,
    MappedPropertyApply,
    MultiEdgeConnectionApply,
    ViewApply,
    ViewId
)
acts_in_edge_type = DirectRelationReference(space="imdb", external_id="acts-in")
movie_view = ViewApply(
    space="imdb",
    external_id="Movie",
    version="1",
    name="Movie",
    properties={
        "title": MappedPropertyApply(
            container=ContainerId(space="imdb", external_id="Movie"),
            container_property_identifier="title",
        ),
        "actors": MultiEdgeConnectionApply(
            type=acts_in_edge_type,
            direction="inwards",
            source=ViewId("imdb", "Actor", "1"),
            name="actors",
        ),
    }
)
actor_view = ViewApply(
    space="imdb",
    external_id="Actor",
    version="1",
    name="Actor",
    properties={
        "name": MappedPropertyApply(
            container=ContainerId("imdb", "Actor"),
            name="name",
            container_property_identifier="name",
        ),
        "movies": MultiEdgeConnectionApply(
            type=acts_in_edge_type,
            direction="outwards",
            source=ViewId("imdb", "Movie", "1"),
            name="movies",
        ),
    }
)
res = client.data_modeling.views.apply([movie_view, actor_view])
{
  "items": [
    {
      "externalId": "<string>",
      "space": "<string>",
      "version": "<string>",
      "createdTime": 1730204346000,
      "lastUpdatedTime": 1730204346000,
      "writable": true,
      "queryable": true,
      "usedFor": "node",
      "isGlobal": true,
      "properties": {},
      "mappedContainers": [
        {
          "type": "container",
          "space": "<string>",
          "externalId": "<string>"
        }
      ],
      "name": "<string>",
      "description": "<string>",
      "filter": {
        "and": [
          {
            "in": {
              "property": [
                "tag"
              ],
              "values": [
                10011,
                10011
              ]
            }
          },
          {
            "range": {
              "property": [
                "weight"
              ],
              "gte": 0
            }
          }
        ]
      },
      "implements": [
        {
          "type": "view",
          "space": "<string>",
          "externalId": "<string>",
          "version": "<string>"
        }
      ]
    }
  ]
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Body

application/json

Views to add or update.

items
object[]
required

List of views to create/update

Required array length: 1 - 100 elements

Response

List of views

items
object[]
required

List of views

Last modified on April 23, 2026