Filter relationships

Lists relationships matching the query filter in the request. You can retrieve a maximum of 1000 relationships per request.

Securityoidc-token or oauth2-client-credentials or oauth2-open-industrial-data or oauth2-auth-code
Request
Request Body schema: application/json
required

Data required to filter relationships. Combined filters are interpreted as an AND operation (not OR). Only relationships that match ALL the provided filters are returned.

object (advancedListFilter)

Filter on relationships with exact match. Multiple filter elements in one property, for example sourceExternalIds: [ "a", "b" ], returns all relationships where the sourceExternalId field is either aorb`. Filters in multiple properties return relationships that match all criteria. If the filter is not specified, it defaults to an empty filter.

limit
integer [ 1 .. 1000 ]
Default: 100

Limits the number of results to return.

cursor
string
fetchResources
boolean (fetchResources)
Default: false

If true, will try to fetch the resources referred to in the relationship, based on the users access rights. Will silently fail to attatch the resources if the user lacks access to some of them.

partition
string (Partition)

Splits the data set into N partitions. The attribute is specified as a "M/N" string, where M is a natural number in the interval of [1, N]. You need to follow the cursors within each partition in order to receive all the data.

To prevent unexpected problems and maximize read throughput, you should at most use 10 (N <= 10) partitions.

When using more than 10 partitions, CDF may reduce the number of partitions silently. For example, CDF may reduce the number of partitions to K = 10 so if you specify an X/N partition value where X = 8 and N = 20 - i.e. "partition": "8/20"- then CDF will change N to N = K = 10 and process the request. But if you specify the X/N partition value where X = 11 (X > K) and N = 20 - i.e. "partition": "11/20"- then CDF will reply with an empty result list and no cursor in the response.

In future releases of the resource APIs, Cognite may reject requests if you specify more than 10 partitions. When Cognite enforces this behavior, the requests will result in a 400 Bad Request status.

Responses
200

One page of relationships stored by CDF that match the provided filter.

400

General error object.

409

Conflict error. Typically issued if external IDs on any relationship already exists, or if there are duplicate external IDs in the request itself.

post/relationships/list
Request samples
application/json
{
  • "filter": {
    • "sourceExternalIds": [
      ],
    • "sourceTypes": [
      ],
    • "targetExternalIds": [
      ],
    • "targetTypes": [
      ],
    • "dataSetIds": [
      ],
    • "startTime": {
      },
    • "endTime": {
      },
    • "confidence": {
      },
    • "lastUpdatedTime": {
      },
    • "createdTime": {
      },
    • "activeAtTime": {
      },
    • "labels": {
      },
    • "sourcesOrTargets": [
      ]
    },
  • "limit": 100,
  • "cursor": "4zj0Vy2fo0NtNMb229mI9r1V3YG5NBL752kQz1cKtwo",
  • "fetchResources": false,
  • "partition": "1/10"
}
Response samples
application/json
{
  • "items": [
    • {
      }
    ],
  • "nextCursor": "string"
}