By Daniel Du
I believe you’ve already heard of Autodesk View and Data API, but if you haven’t, here is the idea, the View & Data API enables web developers to very easily display 3D (and 2D) models on a WebGL-enabled browser. Please check out this post for details.
To view your 3D or 2D models in viewer, you need to upload them to Autodesk cloud and get it translated with REST API. Of course you need a container in cloud for the model to be translated. This container is a “bucket”. Before uploading a file, create a bucket and set a retention policy if this is your first time to use the View and Data API.
About the bucket, here are something you need to know.
Life cycle of bucket:
Briefly, bucket has following 3 retention policies:
- Transient: cache-like storage that persists for only 24 hours, ideal for intermittent objects.
- Temporary: storage that persists for 30 days. Good for data that is uploaded and accessed, then not needed later. This type of bucket storage will save your service money.
- Persistent: storage that persists until it’s deleted. Items that have not been accessed for 2 years may be archived.
For transient buckets and temporary buckets, objects in bucket and the bucket itself will be deleted once the time frame is out. For persistent bucket, objects and buckets will be persistent until you delete them explicitly. One exception is that, if you delete your app consumer key from http://developer.autodesk.com, your data will be deleted.
Naming of bucket:
There are also some restrictions on the characters used in the bucket name.
- The bucket key (i.e. bucket name) must match “^[-_.a-z0-9]{3,128}$”. That is bucket must be between 3 to 128 characters long and contain only lowercase letters, numbers and the symbols . _ –
- Bucket keys are unique within the data center or region in which they were created, that means you cannot create a bucket with a name has been take by others. So best practice is the incorporate your company name/domain name or even the consumer key into the bucket name. If you prefer to use the consumer key(should convert to lowercase first) as part of bucket name, please pay attention to the length of it, which should be less than 128.
- A bucket key cannot be changed once it is created.
Permission of bucket:
Buckets are arbitrary spaces created and owned by services. The service creating the bucket is the owner of the bucket, and the owning service will always have full access to a bucket. In another word, the app with specify consumer key/secret key is the owner of it’s bucket. Other apps with different consumer key/secret key do not have the permission to read/write to the bucket by default. This is to protect your properties in cloud, no one can access your data without your authorization. Furthermore, if you have registered 2 apps on http://developer.autodesk.com, one app cannot access the models which are uploaded/registered by another app.
FAQs:
Q: Do I need to create a bucket every time when I update my models?
A: No, a bucket can contain many objects. We suggest to create only one bucket for one App.
Q: When I query the existence of bucket before creating one, it exists, but I get 403 forbidden error when I try to upload models to it?
A: Refer to the bucket name policy and permission policy. One possible reason is the bucket with the name has been created by others while you do not have access to it. When you get info about the bucket, it also provides the ID of the owner. So you could check based on that if it is the same as your consumer key. If it’s not then you’re not the owner and you should try to create a new bucket:
{
"key" : "mybucket",
"owner" : "obQDn8P0GanGFQha4ngKKVWcxwyvFAGE”, << consumer key
"createDate" : 1401735235495,
"permissions" : [{
"serviceId" : "obQDn8P0GanGFQha4ngKKVWcxwyvFAGE",
"access" : "full"
}
],
"policyKey" : "transient"
}
Q: How do I enumerate the objects in my buckets?
A: Currently there is no such APIs to iterate through the bucket. Best practice is maintaining a local database, saving the object list into your local database before uploading it.
Q: How do I delete a bucket?
A: Currently there is no public APIs to do that. You can use the undocumented "Delete" REST API to delete a bucket at your own risk.
Q: How do I delete an object in one bucket?
A: Currently there is no public APIs to do that.You can use the undocumented "Delete" REST API to delete a bucket at your own risk.
Q: If you upload same file into same bucket, will it overwrite the existing one? Does it support versioning?
A: The Upload API supports uploading objects as a single file (the entire POST body is treated as file content) as well as resumable uploads for large files. If you are uploading object using single file post, and during upload it is determined that the bucket key and object key combination already exists, then the uploaded content will overwrite what is already in this bucket key / object key location. OSS does not support versioning.
Q: What happened to my data in persistent bucket if I do not need it anymore?
A: Object Storage Service(OSS) still retains the right to archive items in a persistent bucket that have not been accessed in 2 years. Objects of this age will be archived, and the applications using Persistent buckets, will need to handle the archived response and method of retrieving.
Q: Will my transient bucket or temporary bucket be removed after 24 hours or 30 days?
A: No. Buckets themselves never expire, only the objects in them do. An object would expire after 24 hours in a transient bucket , or after 30 days if it is in a temporary bucket.
Q : Will my translated viewable contents also expire if they are translated from transient or temporary bucket?
A: No, translated viewable contents(knows as derivatives) do not expire with the seed objects in transient or temporary bucket.
Comments