我们正在按照上传文件的教程进行操作,但似乎无法成功完成最后一步(步骤 5:创建上传文件的第一个版本)。我们能够成功解析目标项目和文件夹,创建存储位置,并将文件上传到存储位置。
然后,我们尝试调用端点以在文件夹中创建文件的版本。
POST https://developer.api.autodesk.com/data/v1/projects/{the project id}/items
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"attributes": {
"displayName": "Sample.jpg",
"extension": {
"type": "items:autodesk.core:File",
"version": "1.0"
}
},
"relationships": {
"tip": {
"data": {
"type": "versions",
"id": "1"
}
},
"parent": {
"data": {
"type": "folders",
"id": "{the project id}"
}
}
}
},
"included": [
{
"type": "versions",
"id": "1",
"attributes": {
"name": "Sample.jpg",
"extension": {
"type": "versions:autodesk.core:File",
"version": "1.0"
}
},
"relationships": {
"storage": {
"data": {
"type": "objects",
"id": "{object id return from file upload}"
}
}
}
}
]
}
响应始终为 400(错误请求),并包含以下详细信息:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "ed1ae266-ebe5-4414-999a-8b6302317639",
"status": "400",
"code": "BAD_INPUT",
"title": "One or more input values in the request were bad",
"detail": "Request input is invalid for this operation."
}
]
}
任何帮助是极大的赞赏。