0

I'm trying to delete an object from a bucket. Reading the docs it all sounds super simple, but I just can't seem to get it working.

I'm following the instructions here to try and delete this object, which I can see using https://developer.api.autodesk.com/oss/v2/buckets/my-persistent-bucket/objects:

bucketKey => 'my-persistent-bucket'
        objectKey => '--test2.dwg'
        objectId => 'urn:adsk.objects:os.object:my-persistent-bucket/--test2.dwg'
        sha1 => '477085439a60779064d91fd1971d53c77c7a163a'
        size => (int) 188600
        location => 'https://developer.api.autodesk.com/oss/v2/buckets/my-persistent-bucket/objects/--test2.dwg' 

According to the docs we use this end point:

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

Where

:bucketKey is url encoded 'my-persistent-bucket'

:objectName is url encoded 'urn:adsk.objects:os.object:my-persistent-bucket/--test2.dwg'

I've tried using PHP's urlencode() and the following base64 encode function:

private function _base64url_encode($data) {
  return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}

to encode the :bucketKey and :objectName but no matter how I try to encode it I always get:

404 : Object not found

Could anyone help me understand where I'm going wrong?

Thanks a lot

Kev Wilson
  • 470
  • 6
  • 19

1 Answers1

2

Of course, after I've made a SO post I find the answer.

For anyone having the same issues you must encode your :objectName, which is just the filename, in my example '--test2.dwg', using PHP's rawurlencode() function rather than urlencode().

Kev Wilson
  • 470
  • 6
  • 19