Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Using SDK and Deserialization Exceptions #107

Open
davidyardy opened this issue Jan 25, 2023 · 0 comments
Open

Using SDK and Deserialization Exceptions #107

davidyardy opened this issue Jan 25, 2023 · 0 comments

Comments

@davidyardy
Copy link

I am follow code sample on https://github.com/Autodesk-Forge/forge-api-dotnet-client/blob/master/docs/DerivativesApi.md#getmetadata

  try
            {
                Metadata result = apiInstance.GetMetadata(urn, acceptEncoding);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling DerivativesApi.GetMetadata: " + e.Message );
            }

I am getting exception about unable to convert to Metadata (deserilization).

It looks like I need to modify to this to avoid this error/exception.

          Autodesk.Forge.Model.DynamicJsonResponse result = await apiInstance.GetMetadataAsync(urn, acceptEncoding);
           Metadata m = result.ToObject<Metadata>();

Now I can get the Metadata result. Can you confirm this is correct?

@davidyardy davidyardy changed the title Using SDK and Deserilization Using SDK and Deserialization Exceptions Jan 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant