Deleting a file from bucket. Autodesk-forge

2019-09-18 09:13发布

There are problem with deleting a file from wip.dm.prod bucket ("errorCode": "AUTH-012"). But I can download current file by using -x GET instead of -x DELETE.

I use this tutorial -> https://developer.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectName-DELETE/ . Attach an example below.

Request

curl 
-v https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/de34f4c9-457c-4653-a9e4-8bbad12bf5ec.rvt 
-X DELETE 
-H "Authorization:Bearer G3fqI9NFKqJVN5MQy3yI0tGXXXXX"

Response

{  
   "developerMessage": "ACM check failed, user or calling service does not have access to perform this operation",  
   "userMessage": "",  
   "errorCode": "AUTH-012",
   "more info": "http://developer.api.autodesk.com/documentation/v1/errors/AUTH-012"
}

Could you please check me and explain me what could be wrong?

1条回答
混吃等死
2楼-- · 2019-09-18 09:56

For file deleting we can use deleting of file version.

curl 
-v https://developer.api.autodesk.com/data/v1/projects/{project_Id}/versions
-x POST
-H "Authorization:Bearer G3fqI9NFKqJVN5MQy3yI0tGXXXXX"
-H "Content-Type:application/vnd.api+json"
-d '{
  "jsonapi": {
    "version": "1.0"
  },
  "data": {
   "type": "versions",
   "attributes": {
     "extension": {
       "type": "versions:autodesk.core:Deleted",
       "version": "1.0",
     }
   },
   "relationships": {
     "item": {
       "data": { 
            "type": "items", 
            "id": "urn:adsk.___your_file_id__________" 
         }
       }
     }
   }
 }'

Where:

{project_Id} - is your project id;

"urn:adsk.___your_file_id__________" - is your file id.

查看更多
登录 后发表回答