0

I want to be able to delete files from the Autodesk Viewer. When I delete them - I want them to disappear from my dropdown and not appear as "Model not translated".

I was using the code from this tutorial - https://get-started.aps.autodesk.com/tutorials/simple-viewer/.

For context, I tried to download models and the solution I found was:

service.downloadObject = async (urn) => {
  const { access_token } = await service.getInternalToken();

  let decodedUrn = Buffer.from(urn, "base64").toString("utf8");

  let urnParts = decodedUrn
    .replace("urn:adsk.objects:os.object:", "")
    .split("/");

  let bucketKey = urnParts[0];
  let objectKey = urnParts[1];

  try {
    const response = await fetch(
      `https://developer.api.autodesk.com/oss/v2/buckets/${bucketKey}/objects/${objectKey}/signeds3download`,
      {
        method: "GET",
        headers: {
          Authorization: `Bearer ${access_token}`,
        },
      }
    );

    const data = await response.json();
    return data.url;
  } catch (err) {
    console.error("Error fetching download URL:", err);
    throw new Error("Failed to retrieve download URL.");
  }
};

Initially, I tried with let response = await ossClient.signedS3Download(bucketKey, objectKey, { accessToken }); for downloading models which gave me a 401 Unauthorized Error. Could I please get some help creating a similar method to completely delete models?

Thank you!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.