I tried uploading an image to Autodesk Construction Cloud using the Autodesk Data Management API. This is the tutorial I followed. However, in the final step, when executing the POST projects/:project_id/items
API, I encountered an error.
{
jsonapi: { version: '1.0' },
errors: [
{
id: '{masked}',
status: '400',
code: 'BAD_INPUT',
title: 'One or more input values in the request were bad',
detail: 'Request input is invalid for this operation.'
}
]
}
Below is my actual request body, which has no differences from the sample request body structure.
{
"data": {
"attributes": {
"displayName": "sample.jpg",
"extension": {
"type": "items:autodesk.bim360:File",
"version": "1.0"
}
},
"relationships": {
"parent": {
"data": {
"id": "urn:adsk.wipprod:fs.folder:{masked}",
"type": "folders"
}
},
"tip": {
"data": {
"id": "1",
"type": "versions"
}
}
},
"type": "items"
},
"included": [
{
"attributes": {
"extension": {
"type": "items:autodesk.bim360:File",
"version": "1.0"
},
"name": "sample.jpg"
},
"id": "1",
"relationships": {
"storage": {
"data": {
"id": "urn:adsk.objects:os.object:wip.dm.prod/{masked}.jpg",
"type": "objects"
}
}
},
"type": "versions"
}
],
"jsonapi": {
"version": "1.0"
}
}
I couldn't find any issues with the information in my request body. Could someone please help me?
You may try this
{
"data": {
"attributes": {
"displayName": "sample.jpg",
"extension": {
"type": "items:autodesk.bim360:File",
"version": "1.0"
}
},
"relationships": {
"parent": {
"data": {
"id": "urn:adsk.wipprod:fs.folder:{masked}",
"type": "folders"
}
},
"tip": {
"data": {
"id": "1",
"type": "versions"
}
}
},
"type": "items"
},
"included": [
{
"attributes": {
"extension": {
// "type": "items:autodesk.bim360:File",
"type": "versions:autodesk.bim360:File",
"version": "1.0"
},
"name": "sample.jpg"
},
"id": "1",
"relationships": {
"storage": {
"data": {
"id": "urn:adsk.objects:os.object:wip.dm.prod/{masked}.jpg",
"type": "objects"
}
}
},
"type": "versions"
}
],
"jsonapi": {
"version": "1.0"
}
}