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.

No matter where you store your files, the binary content will be stored in an OSS bucket - in the case of a file version the link to the binary is provided in the storage section of the GET /version endpoint's reply.  

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:

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

This will provide other info as well about the item:

Also, different endpoints of the APS 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://aps.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/ says:

urn*
(string)

The design URN; returned when uploading the file to APS
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://aps.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 APS 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