How to import Azure Digital Twins Graph using SDK or API?

Gurinder Singh 0 Reputation points
2023-10-11T09:09:32.8433333+00:00

Hi,

I wanted to know is there any way to use import graph and export graph buttons of Azure digital twin explorer through API and programming?

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
231 questions
{count} votes

2 answers

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 34,701 Reputation points
    2023-10-11T09:57:59.5466667+00:00

    Gurinder Singh Greetings & Welcome to Microsoft Q&A forum!

    I wanted to know is there any way to use import graph and export graph buttons of Azure digital twin explorer through API and programming?

    I understand that, you are looking for suggestions to import Azure Digital Twins Graph using SDK or API.

    This feedback has already been shared here and our team is working on this feature but no timeline for it.

    Currently there is no built-in way to achieve this. Import is the only programmatic bulk operation available today. Please see az dt job import for more details.

    You can use the Jobs API to upload multiple models, twins, and relationships to your instance in a single API call, effectively creating the graph all at once.

    Also, see Azure Digital Twins APIs and SDKs for more details.

    Do let me know if you have any further queries.

    0 comments No comments

  2. Sander van de Velde | MVP 33,136 Reputation points MVP
    2023-10-11T10:09:09.77+00:00

    Hello @Gurinder Singh,

    the Azure Digital Twins graph is constructed by creating twins based on Models having Model relationships.

    There is no default export and import tooling available.

    There is a C# NuGet package available for manipulating the Azure Digital Twins Environment.

    For example, check out this example about bulk upload of models.

    See this documentation example on how to create an actual twin.

    Once the twins are created, you can add all relationships.

    To retrieve the graph, check out the 'GetRelationships' method and combine it with the 'GetDigitalTwin' so you can persist it yourself. You can also query for all twins, this way you also have control over twins without relationships.

    A more elaborate graph creation example is documented here.

    For production, check out the Jobs feature to alter the graph. You need access to a blob storage to work with this.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.