Access Cloud Models with Design Automation

Access Cloud Models with Design Automation

peter_sylvester
Contributor Contributor
524 Views
4 Replies
Message 1 of 5

Access Cloud Models with Design Automation

peter_sylvester
Contributor
Contributor

I have a Revit DA application where I am trying to access an ACC model.

I've done as described in the docs.

My WorkItem in Postman looks like:

{
    "activityId": "{{dasNickName}}.NVCMActivityTXT+testTXT",
    "arguments": {
        "NVCMParams" : {
	    "url": "data:application/json, [{'Region': 'US', 'ProjectId': '062b8c8b-d33b-473f-9760-1e811629071a', 'ModelGuid': 'c20b5561-4f6b-4eb1-b9b7-84bfe163ff7a'}, {'Region': 'US', 'ProjectId': '062b8c8b-d33b-473f-9760-1e811629071a', 'ModelGuid': 'c20b5561-4f6b-4eb1-b9b7-84bfe163ff7a'}]"
    },
    "result": {
        "url": "urn:adsk.objects:os.object:{{ossBucketKey}}/{{ossOutputFileObjectKey}}",
            "verb": "put",
            "headers": {
                "Authorization": "Bearer {{dasApiToken}}"
            }
        }
    },
    "adsk3LeggedToken" : "{{adsk3LeggedToken}}"
}

 

{{adsk3LeggedToken}} is a valid token that when used in other calls works perfectly (e.g. Get Hubs, Projects... etc)

Still, when trying to open a cloud model I am getting the following error.

Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: You must sign in to Autodesk 360 in order to complete this action.
[02/09/2025 14:20:40] at Autodesk.Revit.DB.ModelPathUtils.ConvertCloudGUIDsToCloudPath(String region, Guid projectGuid, Guid modelGuid)
[02/09/2025 14:20:40] at NebulaDA.Revit.DB.ExternalDBApplication.DesignAutomationReadyEvent(Object sender, DesignAutomationReadyEventArgs e)

 

Despite spending a lot of time on this, I still don't know what may be going wrong 😞
Could anybody please help me out with the solution, thoughts, ideas?

Thanks!

0 Likes
Accepted solutions (1)
525 Views
4 Replies
Replies (4)
Message 2 of 5

ricaun
Advisor
Advisor

Hello,

 

I was testing that adsk3LeggedToken, some weeks ago and was able to make work with no problem.

 

You could check if the user changed and the login userid is available.

 

Console.WriteLine($"Username: \t{application.Username}");
Console.WriteLine($"LoginUserId: \t{application.LoginUserId}");

 

I suppose the 'You must sign in to Autodesk 360 in order to complete this action.' only happens when the user is not login.

 

Here some references:

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 3 of 5

peter_sylvester
Contributor
Contributor

Seemingly during the execution of the activity there is no user logged on ! 😞

[02/10/2025 12:16:53] ===> Username: acesuser
[02/10/2025 12:16:54] ===> LoginUserId:

 

My Workitem thou DOES Include the 3Legged access token

Request Body
{
    "activityId": "NVCloudManagerDA.NVCMActivity2024+test2024",
    "arguments": {
        "NVCMParams" : {
	    "url": "data:application/json, [{'Region': 'US', 'ProjectId': '062b8c8b-d33b-473f-9760-xxx', 'ModelGuid': 'c20b5561-4f6b-4eb1-b9b7-xxx'}]",
    },
    "result": {
        "url": "urn:adsk.objects:os.object:nv_cm_bucket/nv_cm_output",
            "verb": "put",
            "headers": {
                "Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IlhrU............7CFT7KL2A"
            }
        }
    },
    "adsk3LeggedToken" : "eyJhbGciOiJSUzI1NiIsImtpZC......7kg"
}

 

Any Ideas about why is my user not logged in? 

Appreciate your help.

0 Likes
Message 4 of 5

ricaun
Advisor
Advisor

The only thing I'm doing different is that I'm using the Design Automation c# sdk and the only way I found to enable the adsk3LeggedToken was using a StringArgument and that result in something like this:

 

{
  "activityId": "ricaun.RevitAddin_DA_Tester2022Activity+dev",
  "arguments": {
    "input": {
      "url": "/Masked:url",
      "verb": "get"
    },
    "output": {
      "url": "https://cdn.us.oss.api.autodesk.com/Masked:url",
      "verb": "put"
    },
    "adsk3LeggedToken": {
      "value": "Masked:token"
    }
  }
}

 

I suppose both ways should work, I didn't test the way you are doing like in the blog reference.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 5 of 5

peter_sylvester
Contributor
Contributor
Accepted solution

Duh! I've found it! Such a silly mistake!

My adsk3LeggedToken was OUTSIDE of the "arguments" scope when submitting the new WorkItem request!

 

Thanks  for your help!

Peter