0

I am trying to reproduce the tutorial for Autodesk OSS, uploading a file to then convert it to an SVF. (https://aps.autodesk.com/en/docs/model-derivative/v2/tutorials/prep-file4viewer/task2-upload_source_file_to_oss/)

At the step where I upload the file, I use PUT with the previously retrieved URL to upload the file. However, the call returns an error "The specified methos is not allowed against this resource."

What am I doing wrong?

The file is a valid Revit about 4Mb in size. The call is in a windows .bat file like this (amazon secrets excluded):

set UPLOAD_URL=https://com-autodesk-oss-direct-upload.s3-accelerate.amazonaws.com/22/96/05/91/bucket/mybuckrlb1/signed-url-uploads/22960591-f887-4bd6-8b30-5f49c938f6cf?uploadId=sIQeHd.k4OGedrXdBfUv0aRX4STymgN_VL_ax1O0OSwtn3xIEvoKEDz1uH2KpMjx45dNZtFW9ogL295m1DK_meLVaH8YzFXx0DZ0CmWYBybvRoB3zJlAShxZKqitg8dW9G0M5ddm7_n0eaa23tsoSg--&partNumber=1&X-Amz-Security-Token=[token]&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230807T065756Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=[credentials]%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=[signature here]

set FILE_PATH=roofsamplefile.rvt
curl -v -X PUT ^
    %UPLOAD_URL% ^
    -H "Content-Type: application/octet-stream" ^
    --data-binary "@%FILE_PATH%"

The response is this:

<Error><Code>MethodNotAllowed</Code><Message>The specified method is not allowed against this resource.</Message><Method>PUT</Method><ResourceType>UPLOAD</ResourceType><RequestId>90P68QHV7EVGPSSE</RequestId><HostId>CBjCUDY7fHlbJz0YSHkinHu6xIg7oSsL7a8DZrX7F6wd13Hp5qQZ3DBeCSaODMfKoHSympbe9o0=</HostId></Error>

I've tried to do a POST call instead - it returns a different error, MaxMessageLengthExceeded with MaxMessageLengthBytes=2097152.

To note: I have also tried the older way of uploading the file: https://developer.api.autodesk.com/oss/v2/signedresources via a call to https://developer.api.autodesk.com/oss/v2/buckets/[bucket]/objects/[file key]/signed . This upload is successful, so the file, the network, the access token and everything else is fine. Unfortunately, the file uploaded in this way is not visible to the converting job, so I need to make the "recommended" method work.

For completeness - this is the call used to get the upload URL:

curl -X GET ^
    "%API_BUCKETS%/%BUCKET_NAME%/objects/%FILE_PATH%/signeds3upload?minutesExpiration=%LIFESPAN_MINUTES%" ^
    -H "Authorization: Bearer %AUTH_TOKEN%" ^
    -o "output.json" 

I also tried to finalize the file without uploading anything to amazon, just to do a POST call to signed3supload. The response was "The requested resource does not exist".

Upd. 28/08/2023. Since the question arose about the URL not being properly copied from signeds3uploads, here is an unedited example of the URL I am getting: https://com-autodesk-oss-direct-upload.s3.amazonaws.com/0b/c5/d7/f1/bucket/mybuckrlb1/signed-url-uploads/0bc5d7f1-73d7-4e62-ba13-53f535d9df70?uploadId=.dw5.SQzjYwYZna.pHPGxQ6I5ajno32WkruGyZXXT.kPaoC54k5XVlH99VflByfCIKQddkCH8pWfYdU1Q6KF1NqikXnQqUd0Nx3h2m6jEiOwY1w_rJ2..7UX9sy7GzHIf8lo07oC0Uc38XukjJd2vA--&partNumber=1&X-Amz-Security-Token=IQoJb3JpZ2luX2VjENj%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQCJjMDxInMW141uN9Phyd%2BNvf4VWP5FzzHSfc3SjjdLjwIgXxh%2BHBLqIawklB6NUumgIckss9xXG06YfRKZBwtrKQ4qvQUIgP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARAAGgw2MDQ3MzMwMDk0MDMiDG1hZ3gg0OaNYe2TOiqRBZegQQKPp0dl9u%2B89we7vJrFoLWEGsRu3Lgy0xsq29SijwnldiXy6bz07OP8XVSoZfvQyrQTQnScNCB2XMw57Ri6W5SbJ2h4N21Sxgi1aGT25V0q0Nmy1pa5DmZHqHzqMQwNwm9KKiTfugpou2Wl7OEC0vpCUVS06Qcrlu9r3vI%2FtsjEG0%2Bf%2BWMTiQBpZhIgpzD%2BzkHJ1o8Pwtkg3RspC6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FNX5UFKL6BGT%2F20230808%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=e752955c552415ba1a75bb5c74b16343ec466388e18208f585491ab183b7813e

Vitaly
  • 1
  • 1

1 Answers1

0

The URLs returned by the GET signeds3upload endpoint work with the PUT method.

The issue you're getting often happens when users copy/paste URLs around, and the URLs get "polluted" with escape characters. Please consider using a different utility (e.g., postman or insomnia) to generate the upload URL and upload the file.

Petr Broz
  • 8,891
  • 2
  • 15
  • 24
  • Thank you for the response, Petr. I am adding a the full URL I received from signeds3upload to the question text. I believe it is safe to post, as it has expired, but I ready to remove it if you so advise. I do not see any special, escape, polluted characters in it - do you? – Vitaly Aug 28 '23 at 00:35