-
Notifications
You must be signed in to change notification settings - Fork 4
Add custom links beta documentation #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0e58f77
Add custom links beta documentation
shivansh 52f5876
Update fern/docs/pages/custom-links.mdx
shivansh f7597ad
Add a separate section on link type deprecation
shivansh 8b7ea13
Get rid of "custom", just "links"
shivansh c0f987d
Address review comments
shivansh 9d61514
Remove the mention of dangling links
shivansh 1e3e6ce
Remove explicit mention default `false` values in the API payload
shivansh 8ddc6ee
Fix highlight
shivansh c1615ed
Remove "custom" from title
shivansh 1ed3604
Merge branch 'main' into shivansh/add-links-docs
Atul-Butola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
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 | ||
|
||
### Link type | ||
|
||
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: | ||
- [Customization](./object-customization) | ||
- [Custom objects](./custom-objects) | ||
|
||
## Create link types | ||
|
||
<Callout intent="note"> | ||
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. | ||
</Callout> | ||
|
||
To create this relationship, make an API call to create a link type: | ||
|
||
```curl | ||
curl --location 'https://api.devrev.ai/link-types.custom.create' \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Authorization: Bearer <TOKEN>' \ | ||
--data '{ | ||
"name": "Link between ticket and campaign", | ||
"source_types": [ | ||
{ | ||
"leaf_type": "ticket" | ||
} | ||
], | ||
"target_types": [ | ||
{ | ||
"leaf_type": "campaign", | ||
"is_custom_leaf_type": true | ||
} | ||
], | ||
"forward_name": "is parent of", | ||
"backward_name": "is child of", | ||
"deprecated": false | ||
}' | ||
``` | ||
|
||
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 | ||
|
||
## Create links between objects | ||
|
||
Once you have defined a link type, you can create links between objects: | ||
|
||
```curl | ||
curl --location 'https://api.devrev.ai/links.create' \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Authorization: Bearer <TOKEN>' \ | ||
--data '{ | ||
"custom_link_type": "don:core:dvrv-us-1:devo/demo:custom_link_type/1", | ||
"link_type": "custom_link", | ||
"source": "don:core:dvrv-us-1:devo/demo:ticket/1", | ||
"target": "don:core:dvrv-us-1:devo/demo:custom_object/campaign/1" | ||
}' | ||
``` | ||
|
||
shivansh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Callout intent="tip"> | ||
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 | ||
</Callout> | ||
|
||
## List link types | ||
|
||
shivansh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
You can list link types in your organization, with optional filtering: | ||
|
||
```curl | ||
curl --location 'https://api.devrev.ai/link-types.custom.list' \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Authorization: Bearer <TOKEN>' \ | ||
--data '{ | ||
"source_types_v2": [ | ||
{ | ||
"leaf_type": "ticket, | ||
} | ||
] | ||
}' | ||
``` | ||
shivansh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Update link types | ||
|
||
<Callout intent="note"> | ||
Now, you want to expand the source types to allow both issues and tickets to have this relationship | ||
with campaigns. | ||
</Callout> | ||
|
||
You can update the existing link type to include additional source types: | ||
|
||
```curl | ||
curl --location 'https://api.devrev.ai/link-types.custom.update' \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Authorization: Bearer <TOKEN>' \ | ||
--data '{ | ||
"id": "don:core:dvrv-us-1:devo/demo:custom_link_type/1", | ||
"name": "Link type between issue/ticket and campaign", | ||
"source_types_v2": [ | ||
{ | ||
"leaf_type": "issue" | ||
}, | ||
{ | ||
"leaf_type": "ticket" | ||
} | ||
] | ||
}' | ||
``` | ||
|
||
## Create links between objects with subtypes | ||
|
||
<Callout intent="note"> | ||
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. | ||
</Callout> | ||
|
||
```curl {9} | ||
curl --location 'https://api.devrev.ai/link-types.custom.create' \ | ||
--header 'Content-Type: application/json' \ | ||
shivansh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--header 'Authorization: Bearer <TOKEN>' \ | ||
--data '{ | ||
"name": "Link between social media issues and tickets", | ||
"source_types": [ | ||
{ | ||
"leaf_type": "issue", | ||
"subtype": "social_media" | ||
} | ||
], | ||
"target_types": [ | ||
{ | ||
"leaf_type": "ticket" | ||
} | ||
], | ||
"forward_name": "is related to", | ||
"backward_name": "is related to" | ||
shivansh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}' | ||
``` | ||
|
||
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 | ||
|
||
<Callout intent="tip"> | ||
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. | ||
</Callout> | ||
|
||
## Deprecate link types | ||
|
||
<Callout intent="note"> | ||
Link types cannot be deleted, only deprecated. This ensures that existing links maintain | ||
referential integrity and prevents data corruption. | ||
</Callout> | ||
|
||
To deprecate a link type, use the update endpoint and set `deprecated` to `true`: | ||
```curl {6} | ||
curl --location 'https://api.devrev.ai/link-types.custom.update' \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Authorization: Bearer <TOKEN>' \ | ||
--data '{ | ||
"id": "don:core:dvrv-us-1:devo/demo:custom_link_type/1", | ||
"deprecated": true | ||
}' | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where possible, do not structure sentences in future tense. Use present tense instead. (EK00005)