# Generate applink

**URL:** <https://community.bluescape.com/t/generate-applink/3846>\
**Category:** Developer\
**Created:** [July 25, 2023, 1:27am UTC](https://community.bluescape.com/t/generate-applink/3846 "2023-07-25T01:27:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amerehei](https://sea1.discourse-cdn.com/bluescape/user_avatar/community.bluescape.com/amerehei/32/5629_2.png) [@Amerehei](https://community.bluescape.com/u/Amerehei)\
**Post date:** [July 25, 2023, 1:27am UTC](https://community.bluescape.com/t/generate-applink/3846/1 "2023-07-25T01:27:11Z")

</div>

Is there any API to create an applink, just like right click on an item and select “Copy as” and then “Link”

---

<div class="post-metadata">

**Author:** ![stefanieo](https://sea1.discourse-cdn.com/bluescape/user_avatar/community.bluescape.com/stefanieo/32/722_2.png) [@stefanieo](https://community.bluescape.com/u/stefanieo)\
**Post date:** [July 25, 2023, 2:55pm UTC](https://community.bluescape.com/t/generate-applink/3846/2 "2023-07-25T14:55:25Z")

</div>

Hi, @Amerehei  
We are actively working to connect with the proper subject matter expert and gather up-to-date information for you. We will share our findings as soon as we are able. Thank you for being so patient. 😃

---

<div class="post-metadata">

**Author:** ![kkoechley](https://sea1.discourse-cdn.com/bluescape/user_avatar/community.bluescape.com/kkoechley/32/2474_2.png) [@kkoechley](https://community.bluescape.com/u/kkoechley)\
**Post date:** [July 25, 2023, 9:19pm UTC](https://community.bluescape.com/t/generate-applink/3846/3 "2023-07-25T21:19:31Z")

</div>

Hi @Amerehei,

You can programmatically build an appLink URL by using the workspaceId and the objectId you want to link to.

**The appLink format is:**  
`https://client.apps.us.bluescape.com/applink/<yourWorkspaceId>?objectId=<objectToLinkTo>`

You can set traits to create an appLink using the following format, using traits `vocab` and `content`:

```auto
traits:{
  vocab: "http://bluescape.dev/hyperlinks/v1/", 
    content: {
        link: "#64c01b747b56b021723c62f8"
    }
}

```

You can either use this to create an element, or you can use updateTraits to update an existing element. These can be done with either REST or graphQL APIs.

A graphQL example of creating a new shape with an appLink pointing to another element:

```auto
#create shape with json-ld traits data
mutation createShapeWithLinkTraits($ws: String! $x:Float! $y:Float!, $width:Float!, $height:Float!, $textContent:String!) {
        shape1:createShape(
        workspaceId: $ws
            input: {
                text:$textContent
                traits:{
                    vocab: "http://bluescape.dev/hyperlinks/v1/", 
                    content: {
                        link: "#64c01b747b56b021723c62f8"
                    }
                }
                
                mirrorY: false 
                style: {
                    regularShape:{

                        kind:Rectangle
                        width:$width height:$height strokeWidth: 5 
                        #fillColor not working in beta1
                        fillColor: {r:255 g:34 b:255 a:1}
                        strokeColor:{r:0 g:255 b:0 a:1}
                    }   
                }
                transform:{x:$x y:$y}
                textStyle:{
                    fontSize:12
                    verticalAlign:bottom
                    color:{
                        r:0
                        g:0
                        b:255
                        a:1
                    }
                }
            })

        #return values:
        {id kind mirrorY traits}
    }

```

with variables:

```auto
{
    "ws": "{{workspaceID}}",
    "textContent" : "graphQL shape with simple traits",
    "x": 0,
    "y": 0,
    "width": 800,
    "height": 300
}

```

Or you can use updateTraits to update an existing element:

```auto
#update element JSON-LD traits metadata
mutation updateTraitsForLink ($workspaceId:String!, $id:String!, $linkToId:String!){
  updateTraits(workspaceId: $workspaceId id:$id input: {
    vocab: "http://bluescape.dev/hyperlinks/v1/"
    content: {
      link: $linkToId
    }
  })
}

```

with variables:

```auto
{
    "workspaceId": "{{workspaceID}}",
    "id" : "64c031db65246380966440a3",
    "linkToId":"#64c01b747b56b021723c62f8"
}

```

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/bluescape/user_avatar/community.bluescape.com/system/32/710_2.png) [@system](https://community.bluescape.com/u/system)\
**Post date:** [August 24, 2023, 9:19pm UTC](https://community.bluescape.com/t/generate-applink/3846/4 "2023-08-24T21:19:35Z")

</div>

Closed on August 24, 2023, 9:19pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
