Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get DataProject online URL?

6 REPLIES 6
Reply
Message 1 of 7
thomasa88
282 Views, 6 Replies

Get DataProject online URL?

Hi,

 

How do I get the Hub URL for a DataProject, to view the project online? Is it called Autodesk 360? Fusion Team?

 

The URL looks like this when having clicked the "Open on the Web" button in Fusion 360:

 

https://<my email domain + numbers>.autodesk360.com/g/projects/20220710538787581/data/<base 64 string>

 

 

I guess the base64 string might be the ID of the project, but how to get the subdomain of the URL?

 

I have found DataFile.publicLink, but that is to a specific file and it also makes the file public(?).

 

 

 

 

6 REPLIES 6
Message 2 of 7
kandennti
in reply to: thomasa88

Hi @thomasa88 .

 

We have not been able to find out everything, but we will describe as much as we know.

 

This will be in the active document.
The following text command will open the metadata file.

data.metadata

The part that becomes <my email domain + numbers> seems to correspond to the "hubUrl" in the metadata.
The part "20220710538787581" seems to correspond to "ProjectId".
As for the <base 64 string> part, I could not find it at all.

 

The folder containing the metadata files can be obtained with the following command

Cache.path

But I don't know how to get the metadata file name from the active document. I may be able to guess, but I am a little worried.

 

Also, I was able to get a list of metadata files in the cache folder with this command.

Cache.contents

 

This command may also be useful.

data.property

 

Message 3 of 7
thomasa88
in reply to: kandennti

Thanks! A little bit closer.

 

data.property seems good for getting the Hub ID/URL.

 

 

The base64 part in my case is:

 

 

dXJuOmFkc2sud2lwcHJvZDpmcy5mb2xkZXI6Y28ucWdDTEl1UTFSWUN2ME9oQnlKNWd5QQ==

 

 

It translates to:

 

 

urn:adsk.wipprod:fs.folder:co.qgCLIuQ1RYCv0OhByJ5gyA

 

 

 

It is the ID of the folder:

 

 

Python> app.activeDocument.dataFile.parentFolder.id
urn:adsk.wipprod:fs.folder:co.qgCLIuQ1RYCv0OhByJ5gyA

 

 

 

 

I thought that maybe the Fusion Forge API might give the hub URL, but it seems that it does not.

https://aps.autodesk.com/en/docs/data/v2/reference/http/hubs-hub_id-GET/ (The response at the bottom of the page)

 

 

EDIT. Ok, this might be a full but ugly flow:

 

Python> app.activeDocument.dataFile.id 
file_id=urn:adsk.wipprod:dm.lineage:MGXJxer7QiSD0S6cF8CVjg

Text> Cache.path
full_cache_path

# Loop through the "._xx" files in Cache.path, looking for file_id in <LineageUri>
# Grab <hubUrl> and <ProjectId>

Python> app.activeDocument.dataFile.parentFolder.id 
folder_id=urn:adsk.wipprod:fs.folder:co.qgCLIuQ1RYCv0OhByJ5gyA

# Build URL: <hubUrl>/g/projects/<ProjectId>/data/<base64(folder_id)>

 

Message 4 of 7
kandennti
in reply to: thomasa88

Message 5 of 7
thomasa88
in reply to: thomasa88

Thanks! It's nice to see that you are still active on the forums and digging deep into Fusion! 🙂

 

Have you found a way to force a file into the cache, without opening it? Right now, the method fails on some files for me, since they are not in the cache.

DataFile.refresh() does not help.

Message 6 of 7
kandennti
in reply to: thomasa88

@thomasa88 .

 

I don't know how to put the file in the cache without opening it.

I suppose it would be nice if I could get just the metadata from the datafile object, but I don't know how to do that either.

Message 7 of 7
thomasa88
in reply to: thomasa88

Looking closer at the project ID, it seems to be (partially?) date based.

 

Here are the IDs of two projects created maybe 30-60 seconds after each other, at around 2022-12-17 12:48 UTC

 

20221217589885881
20221217589885906
YYYYMMDD

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report