hope all is well. I am trying to use the APS api to pull a list of files from within a project using the endpoint
https://developer.api.autodesk.com/data/v1/projects/${dm_project_id}/folders/${rootFolderID}/search?filter[fileType]=pdf
. This is successfully returning a list of all 91 pdfs in my Project Files (from all subfolders). I am inspecting the links.webview.href
hyperlinks being returned, and for many of them, when I follow the link, it takes me to an error page that reads: “Can’t view the file. It may have been deleted.”
This is odd, because these files do exist in my project folder, and I’m able to navigate to them, but the webview href being returning seems to be for an outdated address.
Thanks!
Trying:
const searchResponse = await axios({
method: 'get',
url: `https://developer.api.autodesk.com/data/v1/projects/${dm_project_id}/folders/${rootFolderID}/search?filter[fileType]=pdf`, //dm_project_id and rootFolderID are defined above
headers: {
'Authorization': `Bearer ${req.session.token}` //req.session.token is also defined above
}
});
const simplifiedList = searchResponse.data.data.map(item => {
return {
id: item.id,
displayName: item.attributes.displayName,
createTime: item.attributes.createTime,
createUserName: item.attributes.createUserName,
lastModifiedTime: item.attributes.lastModifiedTime,
lastModifiedUserName: item.attributes.lastModifiedUserName,
webViewHref: item.links.webView.href
};
});
console.log(simplifiedList);
The returned output is structured as expected, but the webViewHref values sometimes lead to the corresponding file (great!) and sometimes send me to the above described error and not to the file.
Do you know if it’s possible to force it to return the current webview href (assuming the reason I’m getting this error is because the link I’m following is actually outdated)?
Jon Haider is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.