2

I'm building an app where users will add collections of CAD files to an engineering project.

My plan was to have one transient and temporary bucket for the whole app to use for temp storage. Then create a persistent bucket for each project to hold that projects CAD files for the life of the project.

I've worte the functions to create the new buckets for each project as they are created. I started to write the function to delete the bucket if the project is deleted and realised there is no API function to delete a bucket!

Now I'm wondering if I'm thinking about it wrong.

Rather than creating/deleting buckets with projects. Would it be better to have one persistent bucket segmented in some way to hold project files in each segment and delete that with the project?

How would I go about this? Or should I do something else alltogether?

Kev Wilson
  • 470
  • 6
  • 19

2 Answers2

5

Yes it is. It is simply not documented yet. The API works like this when using OSS v2:

DELETE https://developer.api.autodesk.com/oss/v2/buckets/:bucketKey

requires 'bucket:delete' scope

action cannot be undone

It deletes the bucket and all files in it, but viewables will be preserved.

You can test it using the sample here. Checkout the bucketDelete command.

cyrille
  • 2,616
  • 1
  • 10
  • 18
4

There is an API to delete the buckets but I'm not sure it's exposed to public API keys. It's using DELETE verb and requires 'bucket:delete' scope.

On the other hand, as you mentioned, there is not really a need for a per-project bucket, that's really up to you to manage how you create your buckets and place the files in them. To give you an example the Autodesk A360 cloud infrastructure is using a single bucket to place the files of all the customers!

You could get away with simply 3 buckets (one of each type), and manage project/files relationship using a third-party database or a prefix naming mechanism.

Felipe
  • 4,325
  • 1
  • 14
  • 19
  • Thanks a lot. I've been thinking over the weekend and that seems a better solution. I'm going to use a single bucket and use my apps db to manage who gets what. Thanks again. – Kev Wilson Sep 19 '16 at 07:44
  • Cool! I think using a DB is a good idea anyway because it will give you more flexibility when adding features to your App, for example manage your custom metadata attached to each model or to some components inside each model, save persistent states, for example ... – Felipe Sep 19 '16 at 09:31