title: Receiving list of hubs with Autodesk Forge API
body: <p>I am trying to use the Autodesk forge API for C# to get a list of Hubs.
  This is what I have done so far:
  </p>
  
  <pre><code>HubsApi api = new HubsApi();
  Hubs hubs = api.GetHubs();
  </code></pre>
  
  <p>Pretty simple. But when I do so, I get an exception wicht complains, that one cannot convert from <code>DynamicJsonResponse</code> to <code>Hubs</code>. I think, this is because I receive two warnings in my response string and so it is not a Hub Object any longer. The warning looks like this:</p>
  
  <pre><code>"warnings":[  
          {  
             "Id":null,
             "HttpStatusCode":"403",
             "ErrorCode":"BIM360DM_ERROR",
             "Title":"Unable to get hubs from BIM360DM EMEA.",
             "Detail":"You don't have permission to access this API",
             "AboutLink":null,
             "Source":[  
  
             ],
             "meta":[  
  
             ]
          }
  </code></pre>
  
  <p>All of this is wrapped in an Dictionary with four entries and only two of them are data. However, according to Autodesk, this warning can be ignored.</p>
  
  <p>So after that I tried to convert it in a Dictionary and only select the data entry
  </p>
  
  <pre><code>HubsApi api = new HubsApi();
  DynamicJsonResponse resp = api.GetHubs();
  DynamicDictionary hubs = (DynamicDictionary)resp.Dictionary["data"];
  </code></pre>
  
  <p>Then I looped through it:
  </p>
  
  <pre><code>for(int i = 0; i &lt; hubs.Dictionary.Count &amp;&amp; bim360hub == null; i++)
  {
      string hub = hubs.Dictionary.ElementAt(i).ToString();
      [....]
  }
  </code></pre>
  
  <p>But the string <code>hub</code> isn't an json-hub either. It is an array which looks like this: </p>
  
  <pre><code>[
    0,
    {
      "type": "hubs",
      "id": "****",
      "attributes": {...},
      "links": {...},
      "relationships": {...},
    }
  ]
  </code></pre>
  
  <p>And the second element in the array is my hub. I know, how I can select the second element. But there must be a much easier to get the list of hubs.
  In an example in the references it seemd to work with these simple two lines of code:</p>
  
  <pre><code>HubsApi api = new HubsApi();
  Hubs hubs = api.GetHubs();
  </code></pre>
  
  <p>Any ideas, how I manage to get my hubs?</p>