Hi,
I want to create a shared link or get a shared link if it already exists with JavaScript.
If the shared link already exists, returned error has only '.tag'.
error: {
error_summary: 'shared_link_already_exists/..',
error: { '.tag': 'shared_link_already_exists' }
}
So I have no choice to use sharingListSharedLinks
await dbx.sharingCreateSharedLinkWithSettings({
path: fileId,
settings: {
access: 'viewer',
audience: 'team'
}
}).then(res => {
console.log(res.result.url);
}).catch(async e =>{
if(e.error.error['.tag'] === 'shared_link_already_exists'){
console.log(e.error.error.shared_link_already_exists.metadata.url); // undefined
await dbx.sharingListSharedLinks({
path: fileId
}).then((res) => {
console.log(res.result.links[0].url);
}).catch((e) => {
})
}else{
}
})
})
But in API Explorer, error has metadata.url certainly.
Can you please tell me what caused this?
Thanks.