0

I'm trying to get thumbnail from Forge API here

https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/thumbnails/urn-thumbnail-GET/ `

I got it with Postman and axios successfully, and I tried it with RestSharp, HttpClient and GetThumbnail from DerivativesApi (Autodesk.Forge) in C# but only got status code 202 with message:

{"Result":"The thumbnail generating for this graph node is pending"}

I realized that RestSharp and HttpClient only receive code 202 and return results. I don't know how I can wait for code 200 and thumbnail. Can anyone help me?

This is my code:

var request = new RestRequest($"https://developer.api.autodesk.com/modelderivative/v2/designdata/{nameHash}/thumbnail", Method.GET);
request.AddHeader("Authorization", $"Bearer {oauth.access_token}");
var client = new RestClient();
var restRes = client.Execute(request);

1 Answer 1

0

The 202 code typically indicates that the request has been accepted but the response is not available yet. Is it possible that you're asking for a thumbnail of a file that is still being processed by the Model Derivative service? Try inspecting the response headers, and see if there's one called x-ads-job-status which (according to the documentation) should tell you the status of the processing.

Sign up to request clarification or add additional context in comments.

3 Comments

I understand, but I don't know how to download the data after it's done
As I mentioned already, the 202 code indicates that the response is not available yet so when you repeat the request later, it should eventually return 200 OK with the content you want.
Thank Petr Broz, I put it in a loop to get the code 200, and it worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.