Skip to main content

Hi Lucidchart developer community,

I would like to know how I can extract with API the relationship between these two shapes, ie:

 

The API call:

       curl -k --request GET \

            --url https://api.lucid.co/documents/34f5d3b8-560f-4657-a170-214418d1126c/contents \

            --header 'Lucid-Api-Version: 1' \

            --header 'accept: application/json' \

            --header 'authorization: Bearer key-<the_token>' \

 

The result (does not reflect inclusion relationship):

{

  "id": "34f5d3b8-560f-4657-a170-214418d1126c",

  "title": "simple",

  "product": "lucidchart",

  "pages": <

    {

      "id": "0_0",

      "title": "Page 1",

      "index": 0,

      "items": {

        "shapes": t

          {

            "id": "2gtp6vMI4Wka",

            "class": "ProcessBlock",

            "textAreas":

              {

                "label": "Text",

                "text": "B"

              }

            ],

            "customData": ],

            "linkedData": ]

          },

          {

            "id": "Ogtp.VdULkh8",

            "class": "ProcessBlock",

            "textAreas":

              {

                "label": "Text",

                "text": "A"

              }

            ],

            "customData": ],

            "linkedData": ]

          }

        ],

        "lines": T],

        "groups": ],

        "layers": ]

      },

      "customData": ],

      "linkedData": c]

    }

  ],

  "data": {

    "collections": ]

  }

}

 

The question:

How can I determine if the shape A contains shape B? Or if not possible what are the alternative approaches?

 

Best regards,

Gaston

Hi @Gaston Acuse , thank you for contributing to the Lucid for Developers Community. We will look into your question and get back to you.


Hey @Gaston Acuse I tried the same. AFAIK you can’t relate them, as those elements are only ‘visually’ related “A contains B” but not structurally. The API exposes the latter only. 

So to fix this you need to connect both shapes somehow. One options is using a (white) line, the other is grouping. Once done, both infos are available on the API then allowing you to extract the relationship.  

 

Bonus:  use conditional formatting to spot shapes which are not connected/grouped yet.


Hey @tobi, thanks for your excellent input! Confirming you are correct- @Gaston Acuse, our Document Contents endpoint doesn’t return an object’s absolute location on the canvas, so you’ll need to use a line or grouping to be able to identify the relationship in the response.


Reply