Links

Links allow you to create organization-specific relationships between any two objects in DevRev. This feature enables you to define meaningful connections with custom names that reflect your business processes.

This section provides an overview of links and walks you through the process of creating and managing them. By the end of this section, you’ll be able to:

  1. Define link types
  2. Create links between objects
  3. List link types
  4. Update link types
  5. Deprecate link types

Concepts

A link type defines a relationship between two types of objects. It specifies:

  • The source object types that the link initiates from
  • The target object types that the link can be created to
  • A forward name describing the relationship from source to target
  • A backward name describing the relationship from target to source

Supported object types

Links can be created between the following object types:

  • custom object
  • work (issue, ticket, task, opportunity)
  • account, user
  • part (product, capability, feature, enhancement)

For more details on customization or custom object concepts, please refer to the documentation below:

Let’s say you want to establish a parent-child relationship between tickets and a custom object type called “Campaign”. This relationship helps track which tickets are assigned to which campaigns.

To create this relationship, make an API call to create a link type:

1curl --location 'https://api.devrev.ai/link-types.custom.create' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer <TOKEN>' \
4--data '{
5 "name": "Link between ticket and campaign",
6 "source_types": [
7 {
8 "leaf_type": "ticket"
9 }
10 ],
11 "target_types": [
12 {
13 "leaf_type": "campaign",
14 "is_custom_leaf_type": true
15 }
16 ],
17 "forward_name": "is parent of",
18 "backward_name": "is child of",
19 "deprecated": false
20}'

The link type above defines:

  • A descriptive name
  • Source types that the link can be created from (ticket)
  • Target types that the link can be created to (campaign custom object)
  • Forward name (“is parent of”) describing the relationship from ticket to campaign
  • Backward name (“is child of”) describing the relationship from campaign to ticket

Once you have defined a link type, you can create links between objects:

1curl --location 'https://api.devrev.ai/links.create' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer <TOKEN>' \
4--data '{
5 "custom_link_type": "don:core:dvrv-us-1:devo/demo:custom_link_type/1",
6 "link_type": "custom_link",
7 "source": "don:core:dvrv-us-1:devo/demo:ticket/1",
8 "target": "don:core:dvrv-us-1:devo/demo:custom_object/campaign/1"
9}'

When creating a link:

  • Set link_type to "custom_link"
  • Provide the link type ID in custom_link_type
  • Ensure both source and target objects exist

You can list link types in your organization, with optional filtering:

1curl --location 'https://api.devrev.ai/link-types.custom.list' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer <TOKEN>' \
4--data '{
5 "source_types_v2": [
6 {
7 "leaf_type": "ticket,
8 }
9 ]
10}'

Now, you want to expand the source types to allow both issues and tickets to have this relationship with campaigns.

You can update the existing link type to include additional source types:

1curl --location 'https://api.devrev.ai/link-types.custom.update' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer <TOKEN>' \
4--data '{
5 "id": "don:core:dvrv-us-1:devo/demo:custom_link_type/1",
6 "name": "Link type between issue/ticket and campaign",
7 "source_types_v2": [
8 {
9 "leaf_type": "issue"
10 },
11 {
12 "leaf_type": "ticket"
13 }
14 ]
15}'

You may want to restrict links to specific subtypes of objects. For example, only allowing issues of a particular subtype to be linked to tickets.

1curl --location 'https://api.devrev.ai/link-types.custom.create' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer <TOKEN>' \
4--data '{
5 "name": "Link between social media issues and tickets",
6 "source_types": [
7 {
8 "leaf_type": "issue",
9 "subtype": "social_media"
10 }
11 ],
12 "target_types": [
13 {
14 "leaf_type": "ticket"
15 }
16 ],
17 "forward_name": "is related to",
18 "backward_name": "is related to"
19}'

This configuration:

  • Allows issues of subtype “social_media” to be linked to tickets
  • Rejects attempts to link issues with no subtype or with other subtypes

The subtype should exist for the corresponding source type. To add more valid source subtypes, use the update endpoint to add them to the source_types array.

Link types cannot be deleted, only deprecated. This ensures that existing links maintain referential integrity and prevents data corruption.

To deprecate a link type, use the update endpoint and set deprecated to true:

1curl --location 'https://api.devrev.ai/link-types.custom.update' \
2--header 'Content-Type: application/json' \
3--header 'Authorization: Bearer <TOKEN>' \
4--data '{
5 "id": "don:core:dvrv-us-1:devo/demo:custom_link_type/1",
6 "deprecated": true
7}'