Updated on 2022-09-15 GMT+08:00

Querying Relationships

Function

This API is used to query relationships.

URI

GET /v2/{project_id}/design/relation

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

name

No

String

Fuzzy query by name or code

create_by

No

String

Creator

begin_time

No

String

Left boundary for a time filter. This parameter must be used together with end_time.

end_time

No

String

Right boundary for a time filter. This parameter must be used together with begin_time.

limit

No

Integer

Number of records to be queried, that is, Y records. The value ranges from 1 to 100. The default value is 50.

Maximum: 100

Default: 50

offset

No

Integer

Query offset, that is, X data records are skipped. The value must be 0 or an integer multiple of limit. If the value does not meet the requirements, it will be rounded down. The default value is 0.

Default: 0

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

Long

ID

source_table_id

Long

Source table ID

target_table_id

Long

Destination table ID

name

String

Relationship name

source_table_name

String

Source table name

target_table_name

String

Destination table name

role

String

Role

tenant_id

String

Tenant ID

source_type

String

Relationship type

Enumeration values:

  • ONE

  • ZERO_OR_ONE

  • ZERO_OR_N

  • ONE_OR_N

target_type

String

Relationship type

Enumeration values:

  • ONE

  • ZERO_OR_ONE

  • ZERO_OR_N

  • ONE_OR_N

create_by

String

Creator

update_by

String

User who updated the relationship

create_time

String

Creation time

update_time

String

Update time

mappings

Array of RelationMappingVO objects

Relationship mappings

Table 4 RelationMappingVO

Parameter

Type

Description

id

Long

ID

relation_id

Long

Relationship ID

source_field_id

Long

Source field ID

target_field_id

Long

Destination field ID

source_field_name

String

Source field name

target_field_name

String

Destination field name

create_by

String

Creator

update_by

String

User who updated the mapping

create_time

String

Creation time

update_time

String

Update time

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.000 which indicates that the request was successfully processed.

error_msg

String

Error message

data

Object

Returned data

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.000 which indicates that the request was successfully processed.

error_msg

String

Error message

data

Object

Returned data

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.000 which indicates that the request was successfully processed.

error_msg

String

Error message

data

Object

Returned data

Example Requests

None

Example Responses

Status code: 200

The operation succeeds. The RelationVO array and the total number of relationships are returned.

{
  "id" : "1000068927784710144",
  "source_table_id" : "873243083737899008",
  "target_table_id" : "888462883313393664",
  "name" : "sdi_taxi_trip_data_wang_1",
  "source_table_name" : "demo_sdi_db.sdi_taxi_trip_data",
  "target_table_name" : "default.wang",
  "role" : null,
  "tenant_id" : "0cf68da0ba80f2962ff7c01ba8c0b7f7-workspace-f7eee36e67e541a59679f9b1b7f4eab0",
  "source_type" : "ONE_OR_N",
  "target_type" : "ONE_OR_N",
  "create_by" : "abc",
  "update_by" : "abc",
  "create_time" : "2022-07-22T15:56:53+08:00",
  "update_time" : "2022-07-22T15:57:28+08:00",
  "mappings" : [ {
    "id" : "1000068927818264576",
    "relation_id" : "1000068927784710144",
    "source_field_id" : "873243083737899013",
    "target_field_id" : "888462883317587968",
    "source_field_name" : "trip_distance",
    "target_field_name" : "id",
    "create_by" : "abc",
    "update_by" : "abc",
    "create_time" : "2022-07-22T15:56:53+08:00",
    "update_time" : "2022-07-22T15:57:28+08:00"
  } ]
}

Status Codes

Status Code

Description

200

The operation succeeds. The RelationVO array and the total number of relationships are returned.

400

BadRequest

401

Unauthorized

403

Forbidden