Introduction to Anchor Endpoints#

Anchors are an attachment point. Resources attached to an anchor are called extensions. For example, comments and source links are extensions on anchors. Anchors may be created in an individual table cell, in a rich text element, or on drawing content.

In this guide, you’ll learn:

  • How do I retrieve anchors in rich text?

  • How do I retrieve anchors in a table?

  • What should I keep in mind when working with anchors?

Anchors are often used to create source links. You can read more about working with links at the Linking guide.

How do I retrieve anchors in rich text?#

In this exercise, you’ll retrieve a list of all anchors in rich text and then inspect a specific anchor to learn more about it.

Before starting, you’ll need a richTextId. To learn more about rich text, including how to obtain this id, read the Rich Text Guide.

Retrieving a list of rich text anchors#

To retrieve a list of rich text anchors, you pass in the richTextId. Replace this value (the characters between richText/ and /anchors) with your own value.

Request#
curl -X GET -H "Authorization: Bearer ${token}" https://api.app.wdesk.com/prototype/platform/content/richText/WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g/anchors
Response#
{
    "data": [
        {
            "id": "WA3V0cXR2BAtZrc6ANjr1BSO9BiL1R5nd8UXZ2Jr06BHt3MhDeV2QukapQZ3F89A9BT199fVl",
            "content": {
                "type": "richText",
                "richText": "WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g"
            },
            "attachmentPoint": {
                "type": "richTextSelection",
                "richTextSelection": {
                    "type": "comment",
                    "selection": {
                        "start": {
                            "paragraphIndex": 0,
                            "offset": 7
                        },
                        "stop": {
                            "paragraphIndex": 1,
                            "offset": 0
                        }
                    }
                }
            },
            "revision": "2c6438ab4540aad2",
            "extensionTypes": [
                "comment"
            ]
        },
        {
            "id": "WA2RlYGVnFRpIvN9ARJyvkFDKumaxA992ZtQGdnN6wrFWpmIwHPRnU9BgLtBdmBt6WU",
            "content": {
                "type": "richText",
                "richText": "WA8jJy8nLubbkEHM99i4dIuJ4CNQDsW8rB7MvLmwCHucbKj61j6tmTLBft2g"
            },
            "attachmentPoint": {
                "type": "richTextSelection",
                "richTextSelection": {
                    "type": "sourceLink",
                    "selection": {
                        "start": {
                            "paragraphIndex": 2,
                            "offset": 0
                        },
                        "stop": {
                            "paragraphIndex": 2,
                            "offset": 17
                        }
                    }
                }
            },
            "revision": "2c6438ab4540aad2",
            "extensionTypes": [
                "destinationLink"
            ]
        }
    ]
}

Notice that this response contains two different anchors. The first is a “comment” anchor, and the second is a “sourceLink” anchor.

How do I retrieve anchors in tables?#

In this exercise, you’ll retrieve a list of all anchors in a table and then inspect a specific anchor to learn more about it.

Before starting, you’ll need a tableId. To learn more about tables, including how to obtain this id, read the Table Guide.

Retrieving a list of table anchors#

To retrieve a list of table anchors, you pass in the tableId. Replace this value (the characters between tables/ and /anchors) in the example with your own value.

Request#
curl -X GET -H "Authorization: Bearer ${token}" https://api.app.wdesk.com/prototype/platform/content/tables/WA69Atra6si12IXSib7E4lJBW8ViFO99K2kRMs2w9Bp07jIowdAh99lCcVw/anchors
Response#
{
    "data": [
        {
            "id": "WA62vrqyuiV9AKXyqZ7kwnJhe9AVCNM99q9AmRsk0wfh27DAqw99Ij99FKeVa6lop2AnYCcgJyAnJmcmZSang",
            "content": {
                "type": "table",
                "table": "WA69Atra6si12IXSib7E4lJBW8ViFO99K2kRMs2w9Bp07jIowdAh99lCcVw"
            },
            "revision": "2c6438ab4540aaa4",
            "attachmentPoint": {
                "type": "tableRange",
                "tableRange": {
                    "range": {
                        "startRow": 0,
                        "stopRow": 0,
                        "startColumn": 0,
                        "stopColumn": 0
                    }
                }
            },
            "extensionTypes": [
                "destinationLink"
            ]
        },
        {
            "id": "WA7GzsrCylUOWQzaF8lA7OguiSD99Q6rO6WtUo3eRq8Cw23849B6E6CSbK5voCcgZyAnICcgIWAhYiGhw",
            "content": {
                "type": "table",
                "table": "WA69Atra6si12IXSib7E4lJBW8ViFO99K2kRMs2w9Bp07jIowdAh99lCcVw"
            },
            "revision": "2c6438ab4540aaa4",
            "attachmentPoint": {
                "type": "tableRange",
                "tableRange": {
                    "range": {
                        "startRow": 1,
                        "stopRow": 1,
                        "startColumn": 0,
                        "stopColumn": 0
                    }
                }
            },
            "extensionTypes": [
                "comment"
            ]
        }
    ]
}

Notice that this response contains two different anchors. The first is a “source link” anchor, which has a destination link as an extension. The second is a “comment” anchor.

What should I keep in mind when working with anchors?#

  • Some anchors are reserved for a specific extension type. For example, rich text anchors are created with a specific anchor type; it is an error to try to add an extension of a different type to that anchor.