23 Apr 2019

ID's in the Data Management API

When debugging things it can be useful to know what the various id's in the Data Management API look like - see above picture.

You can use the https://derivatives.autodesk.io/ sample as well to see the id of the various items: just select anything in the file browser tree and then run this in the browser's console:

$('#forgeFiles').jstree('get_node', $('#forgeFiles').jstree('get_selected')).original

This will provide other info as well about the item:

id of selected item

Also, different endpoints of the Forge API's might require id's in different formats: readable, URL encoded or URL safe base64 encoded. E.g.
- readable: urn:adsk.wipprod:fs.file:vf.BdGQ1od8SWuA4RDlgkwqHg?version=2
- URL encoded: urn%3Aadsk.wipprod%3Afs.file%3Avf.BdGQ1od8SWuA4RDlgkwqHg%3Fversion%3D2
- URL safe base64 encoded (no = padding and replaced by _): dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLkJkR1Exb2Q4U1d1QTRSRGxna3dxSGc_dmVyc2lvbj0y

The documentation of each endpoint of the Forge API's specifies if you need to provide the id in base64 encoded format, e.g. https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/ says:

urn*

string

The design URN; returned when uploading the file to Forge

The URN needs to be Base64 (URL Safe) encoded.

 

If the endpoint needs the id as part of the URL then it needs to be URL encoded like in case of https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-GET/, e.g. https://developer.api.autodesk.com/data/v1/projects/a.YnVzaW5lc3M6YXV0b2Rlc2szNzQzIzIwMTkwMzA4MTgwODczNTUx/versions/urn:adsk.wipprod:fs.file:vf.BdGQ1od8SWuA4RDlgkwqHg%3Fversion=2 

Note: in case of the various Forge SDK's the encoding of the id's are usually taken care of so you just need to pass in the raw/readable version.

Related Article