Deleting a file from bucket. Autodesk-forge

懵懂的女人 提交于 2019-12-11 06:37:10

问题


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:


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.



来源:https://stackoverflow.com/questions/40759754/deleting-a-file-from-bucket-autodesk-forge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!