Search code examples
python-3.xautodesk-forgeautodesk-model-derivative

Model Derivative Forge API - Field uploadKey not found in signed URL endpoint


I was looking to play around with the Forge API and am trying to translate a rvt file into a dwg. I am just following the steps given in the "Step-by-Step" tutorials and this second step in Task 2

https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/translate-to-obj/task2-upload_source_file_to_oss/

says to make a post request to this endpoint to get the signed url https://developer.api.autodesk.com/oss/v2/buckets/<YOUR_BUCKET_KEY>/objects/<YOUR_OBJECT_KEY>/signeds3upload?minutesExpiration=<LIFESPAN_OF_URL>.

I make the request and receive a '{'reason': 'Field uploadKey not found'}'. Which in the steps, it shows you get the uploadKey from this endpoint ? So either I'm missing something really big here, or these steps are too smart for a 5 year old.

Here is what I'm passing into my post request:

header = {
    'Authorization': 'Bearer ' + access_token,
    'Content-Type': 'application/json'
}

body = {
    'ossbucketKey': 'bucketName',
    'ossSourceFileObjectKey': 'test.rvt',
    'access': 'full',
    'policyKey': 'transient'
}

Solution

  • Note that the new direct-to-s3 upload consists of multiple steps:

    1. You generate an upload URL using the GET buckets/:bucketKey/objects/:objectKey/signeds3upload
    2. You upload your data to the URL
    3. You complete the upload using the POST buckets/:bucketKey/objects/:objectKey/signeds3upload endpoint you mentioned, incl. the uploadKey you received in step 1

    For more details you can refer to this blog post: https://forge.autodesk.com/blog/data-management-oss-object-storage-service-migrating-direct-s3-approach.