Azure Digital Twin Step-by-step tutorial - adding more rooms to the model

Gonzalo De La Rocha 0 Reputation points
2023-03-12T10:59:29.9+00:00

Hi all, I have followed this tutorial step by step and I now have it up and running: https://learn.microsoft.com/en-us/azure/digital-twins/tutorial-end-to-end

Whilst creating the client app, the demo only shows us how to create a digital twin with 1 floor, 1 room and 1 thermostat, but for our application we require multiple such rooms and thermostats on one given floor. Whilst creating more than one room, I encounter an error which says:
Error 400: Service request failed.
Status: 400 (Bad Request)

Content:
{"error":{"code":"InvalidRelationshipData","message":"$targetId 'room101' cannot be modified. Please provide valid relationship data. See documentation on managing relationships [http://aka.ms/adtv2twins."}}]

Headers:
Strict-Transport-Security: REDACTED
Date: Sun, March 2023 10:43:00 GMT
Content-Length: 206
Content-Type: application/json; charset=utf-8

User's image

Can you please give a hand? what's the problem? what do I need to change to make it work?

Thanks in advance.

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.
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 36,951 Reputation points MVP Volunteer Moderator
    2023-03-13T08:30:03.2133333+00:00

    Hello @Anonymous ,

    I was able to find the models and load them into an ADT environment:

    User's image

    As you can see, I'm able to construct relationships, including multiple thermostats in the same room.

    Notice I found four models.

    I then checked the models themselves, in Visual Code and it puzzles me how these are related.

    There are no direct (typed) relationships between the different models...

    I suggest your next steps are building new models with relationships that make sense like:

    {
     "@id": "dtmi:com:adt:flightintoint:airliner;5",
     "@type": "Interface",
     "displayName": "Airliner - Flight Into IoT - Interface Model",
     "@context": "dtmi:dtdl:context;2",
     "contents": [
      {
       "@type": "Property",
       "name": "companyName",
       "description": "Name of company",
       "schema": "string"
      },
      {
       "@type": "Property",
       "name": "abbreviation",
       "description": "Abbreviation",
       "schema": "string"
      },
      {
       "@type": "Relationship",
       "@id": "dtmi:com:adt:flightintoiot:airliner_has_airplane;5",
       "name": "rel_has_airplanes",
       "displayName": "Has airplanes",
       "target": "dtmi:com:adt:flightintoiot:airplane;5"
      }
     ]
    }
    

    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.


Your answer

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