Introduction to Linking Endpoints#
Workiva’s Linking endpoints allow you to interact with links in documents and spreadsheets.
Source links are attached to anchors. Destination links are either a DestinationLinkTextElement in rich text or CellDestinationLinkValue in tables.
In this guide, you’ll learn:
How do I link a table cell to rich text?
How do I link rich text to a table cell?
How do I publish value changes to my destination links?
How do I find the source link for a destination?
How do I find the destinations for a source link?
What are some common concepts to consider when working with links?
Example Use Cases#
How do I link a table cell into rich text?#
In this exercise, you will link text from a table cell to a rich text document. To follow these steps, you’ll need:
The
tableId,revision, andCellRangevalues for where the source link is to be created. Refer to Introduction to tables to learn how to retrieve atableIdand identify cell coordinates.The
richTextId,revision, andCaretvalues for where the destination link is to be placed. Refer to Introduction to rich text to learn about obtaining arichTextIdand identifying locations in rich text.
A source link must always be attached to an anchor. If you don’t already have a source link, you will need to create an anchor first.
Creating a table cell anchor#
Use a POST create table anchor call to create the anchor.
You will need the tableId, revision, and CellRange values from the section above.
Important
The CellRange must be the specific individual cell that you want to configure as the source link. Table anchor source links can only be for a single cell.
curl -X POST -H "Authorization: Bearer ${token}" --data @body.json https://api.app.wdesk.com/prototype/platform/content/tables/WA2NiYGJgm7cWr4W6Ka9BHScz56m2AT2FqTmBgekyk399M99I9Bb69BoEt3WHCag/anchors/creation
{
"range": {
"startRow": 0,
"stopRow": 0,
"startColumn": 0,
"stopColumn": 0
},
"revision": "2c6438ab45553de5"
}
A 202 response indicates that your edit request was accepted.
After the request is made, the status of the request can be found through polling the Operations endpoint set in the location header of the creation’s response. When the operation is complete a GET request can be made to the completed operation’s resourceUrl to retrieve the table anchor creation results. The results of this creation request includes the table anchor and the new revision:
curl -X GET -H "Authorization: Bearer ${token}" https://api.app.wdesk.com/prototype/platform/operations/851b155b-fc91-4e78-9f45-f627544844bd/tableAnchorCreationResults
{
"data": [
{
"type": "anchor",
"anchor": "WA3l7enh6Dkm85iyvOn3ujymTB2reZ3tyRq4syjklMoTn4L9B55sDCFHpxd0lUSVRIVEhUQUhATklL"
}
],
"revision": "2c6438ab4540684f"
}
Linking an anchor to rich text#
Now you are ready to create a link.
You will need the values for richTextId, revision, and the position within the rich text where you want to place the anchor. You will also need the source anchorId value from the previous step.
This inserts the destination link at the beginning of the rich text.
curl -X POST -H "Authorization: Bearer ${token}" --data @body.json https://api.app.wdesk.com/prototype/platform/content/richText/WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g/links/edit
{
"revision": "2c6438ab4540684a",
"data": [
{
"type": "insertDestinationLink",
"insertDestinationLink": {
"insertAt": {
"paragraphIndex": 0,
"offset": 0
},
"sourceAnchor": "WA3l7enh6Dkm85iyvOn3ujymTB2reZ3tyRq4syjklMoTn4L9B55sDCFHpxd0lUSVRIVEhUQUhATklL"
}
}
]
}
If the response is 202, your creation request was accepted. Read the Operations guide to learn more about operations.
You have now created the link, and can query the rich text using GET rich text paragraphs to see the new link.
How do I link rich text to a table cell?#
In this exercise, you will link text from a document to a table cell.
To follow these steps, you’ll need:
The
richTextId,revision, andRichTextSelectionvalues for where you will create the source link. Refer to Introduction to rich text to learn about obtaining arichTextIdand identifying locations in rich text.The
tableId,revision, andCellvalues for where you will create the destination link. Refer to Introduction to tables to learn how to retrieve atableIdand identify cell coordinates.
Creating a rich text anchor#
Use a POST create new rich text anchor call using the values identified above.
This request creates a source link starting at the beginning of paragraph index 2 and ending 17 characters later.
curl -X POST -H "Authorization: Bearer ${token}" --data @body.json https://api.app.wdesk.com/prototype/platform/content/richText/WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g/anchors/creation
{
"revision": "2c6438ab45406ba9",
"type": "sourceLink",
"selection": {
"start": {
"paragraphIndex": 2,
"offset": 0
},
"stop": {
"paragraphIndex": 2,
"offset": 17
}
}
}
If you have successfully created the link, a 202 response is returned. Follow the typical Operations pattern until the operation completes.
Linking an anchor to a table cell#
This step links the anchor to the table cell.
You will need the tableId, revision, and table cell ID (Row/Column) values for this table and cell.
This example uses the POST command to create the table link.
curl -X POST -H "Authorization: Bearer ${token}" --data @body.json https://api.app.wdesk.com/prototype/platform/content/tables/WA66srK9At2Z5rMft47ao5WP5E0L0JsKylkXn7He7y5VMwN2guMRcVww/links/edit
{
"revision": "2c6438ab45553de5",
"data": [
{
"type": "insertCellDestinationLink",
"insertCellDestinationLink": {
"insertAt": {
"row": 0,
"column": 0
},
"sourceAnchor": "WA3l7enh6Dkm85iyvOn3ujymTB2reZ3tyRq4syjklMoTn4L9B55sDCFHpxd0lUSVRIVEhUQUhATklL"
}
}
]
}
If the response to this POST is 202, your link creation request was accepted and the link was created. You can now query your table using GET table cells to see your new link.
How do I publish value changes to my links?#
When the value at a source link is changed, the changed value does not immediately propagate to destinations. Changes must be published for this to happen, and this is a separate action. When you publish changes, you can publish only your own changes, or you can publish all changes.
Important
In order to publish all links in a document you must have “document owner” permissions.
Publishing is done at the document level and each supported document type has its own publication endpoint. For a document, use Publish links in a document. Other document types do not yet support publishing via this API.
How do I find the source link for a destination?#
Destination links are identified in content by an id string. You can look up more information about the destination, including its source anchor id, with Retrieve a destination link by id. Once you know the source anchor id, you can then look up the anchor to identify the location of the source.
The following code example shows a call to retrieve a source anchor id.
curl -X GET -H "Authorization: Bearer ${token}" https://api.app.wdesk.com/prototype/platform/content/destinationLinks/WAwYEBQcFOOxAT9BoaSVKaD8g3McVg8AQN3d3b9AM2QSam2KxI2mEOq5wUOCTQrNys3KzcrNzI3Mj8wMQ
{
"id": "WAwYEBQcFOOxAT9BoaSVKaD8g3McVg8AQN3d3b9AM2QSam2KxI2mEOq5wUOCTQrNys3KzcrNzI3Mj8wMQ",
"content": {
"type": "table",
"table": "WAwIAAAMBPOhES9B4eTVaeC8wzNcFk99AAJ2dnf9BMmUTa2yLxYynEeu4w"
},
"revision": "2c6438ab4540aad1",
"source": {
"type": "anchor",
"anchor": {
"anchor": "WA2RlYGVnFRpIvN9ARJyvkFDKumaxA992ZtQGdnN6wrFWpmIwHPRnU9BgLtBdmBt6WU",
"content": {
"type": "richText",
"richText": "WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g"
},
"revision": "2c6438ab45406bb6",
"location": "https://api.app.wdesk.com/prototype/platform/content/richText/WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g/anchors/WA2RlYGVnFRpIvN9ARJyvkFDKumaxA992ZtQGdnN6wrFWpmIwHPRnU9BgLtBdmBt6WU?revision=2c6438ab45406bb6"
}
},
"status": "connected"
}
Now you have an anchorId ("WAwYEBQcFOOxAT9BoaSVKaD8g3McVg8AQN3d3b9AM2QSam2KxI2mEOq5wUOCTQrNys3KzcrNzI3Mj8wMQ"), which will be the location of the source.
Refer to the Anchors guide to learn more about anchors.
How do I get the destinations for a source link anchor?#
Destinations are a type of extension on anchors. You can list all extensions on an anchor with either Retrieve a list of table anchor extensions or Retrieve a list of rich text anchor extensions. The extensions response will provide a list of ids which can be looked up using Retrieve a destination link by id.
The following exercise shows how to get the location of a destination on a table anchor. You’ll need a tableId and table anchorId. The example above illustrates how to obtain these values. In this exercise you will make two calls, the first to retrieve a list of table anchor extensions, and the second to retrieve a destination link using an id.
Retrieve the list of table anchor extensions#
This call retrieves a list of table anchor extensions.
curl -X GET -H "Authorization: Bearer ${token}" https://api.app.wdesk.com/prototype/platform/content/tables/WA69Atra6si12IXSib7E4lJBW8ViFO99K2kRMs2w9Bp07jIowdAh99lCcVw/anchors/WA62vrqyuiV9AKXyqZ7kwnJhe9AVCNM99q9AmRsk0wfh27DAqw99Ij99FKeVa6lop2AnYCcgJyAnJmcmZSang/extensions
{
"data": [
{
"id": "WAyUkISQmVFsJ9BZ7QZmqlVXPv2O0BticmVFsJ9BZ7QZmqlVXPv2O0BtiYm99lnvqAZLZve99hZ5qv0k99ZyEsoaWlpaU1",
"type": "destinationLink"
}
]
}
Retrieve the destination link by id#
This call retrieves a destination link by id.
curl -X GET -H "Authorization: Bearer ${token}" https://api.app.wdesk.com/prototype/platform/content/destinationLinks/WAwYEBQcFOOxAT9BoaSVKaD8g3McVg8AQN3d3b9AM2QSam2KxI2mEOq5wUOCTQrNys3KzcrNzI3Mj8wMQ
{
"id": "WAwYEBQcFOOxAT9BoaSVKaD8g3McVg8AQN3d3b9AM2QSam2KxI2mEOq5wUOCTQrNys3KzcrNzI3Mj8wMQ",
"content": {
"type": "table",
"table": "WAwIAAAMBPOhES9B4eTVaeC8wzNcFk99AAJ2dnf9BMmUTa2yLxYynEeu4w"
},
"revision": "2c6438ab4540aad1",
"source": {
"type": "anchor",
"anchor": {
"anchor": "WA2RlYGVnFRpIvN9ARJyvkFDKumaxA992ZtQGdnN6wrFWpmIwHPRnU9BgLtBdmBt6WU",
"content": {
"type": "richText",
"richText": "WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g"
},
"revision": "2c6438ab45406bb6",
"location": "https://api.app.wdesk.com/prototype/platform/content/richText/WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g/anchors/WA2RlYGVnFRpIvN9ARJyvkFDKumaxA992ZtQGdnN6wrFWpmIwHPRnU9BgLtBdmBt6WU?revision=2c6438ab45406bb6"
}
},
"status": "connected"
}
This response shows that the destination is in a table (content.type: "table") and includes the id of the table. To learn more about working with tables, read the Table Guide.
Common Concepts#
Anchors#
Anchors are an attachment point.
A source link is always attached to an anchor.
Anchors may be created on a table cell, on a selection in rich text, or on drawing content.
Source Link#
A source link is always attached to an anchor.
A single source link may be attached to many destination links.
When a source link changes, its changes are only local. To distribute the changes to the destinations requires that the document or spreadsheet be published.
Destination Link#
A destination link is attached to a table cell or a selection in rich text.
A destination link may be attached to a source link.
A destination link’s value changes only when the source link it is associated with is published.
A destination link without a source link is “broken” and retains the value its previous source link was published with.
Link Publish#
A link publish operation causes all source links in a document to send their values to their destinations.