1

I am trying to upload some models to the Autodesk Forge Data Management API. Unfortunately, the models are 1GB+ in size and the API gives a timeout exception:

StatusCode: 504, ReasonPhrase: 'GATEWAY_TIMEOUT'

Using the following code (C#):

var url = $"https://developer.api.autodesk.com/oss/v2/buckets/{bucketKey}/objects/{objectName}";

        using (var httpClient = GetAuthorizedHttpClient("data:write"))
        {
            httpClient.Timeout = TimeSpan.FromMinutes(120);
            var request = new HttpRequestMessage(HttpMethod.Put, url);

            fileStream.Position = 0;

            request.Content = new StreamContent(fileStream);                

            var response = httpClient.SendAsync(request).Result;

            var responseContent = response.Content.ReadAsStringAsync().Result;

            if (!response.IsSuccessStatusCode)
                throw new Exception($"Failed to upload object: {response.ReasonPhrase}");

            var result = JsonConvert.DeserializeObject<ObjectUploadResult>(response.Content.ReadAsStringAsync().Result);
            return result;
        }

Do you have any suggestions? Thanks in advance!

Johannes Heesterman
  • 1,248
  • 1
  • 12
  • 21

2 Answers2

2

That's expected, you should use resumable upload for files larger than 100Mb (as per documentation).

Check this sample using the Autodesk.Forge .NET package.

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
0

Cause error 416 when uploading large file with the forge-bucketsmanager-desktop.
Please check this issue.

hiroakit
  • 57
  • 1
  • 6