首页 > 解决方案 > 如何使用 ApiClient.Default.CallApi()?

问题描述

查看 Autodesk.Forge 参考属性,我发现了一个名为 CallApiAsync() 的方法,我想用它来发送请求,例如GETAutodesk BIM 360 项目的属性。

以下是 CallApiAsync() 使用的参数,但有人可以解释它们每个是什么以及null我不需要的参数如何?

CallApiAsync(string path, 
             RestSharp.Method method, 
             System.Collections.Generic.Dictionary<string, string> queryParams, 
             object postBody, 
             System.Collections.Generic.Dictionary<string, string> headerParams,
             System.Collections.Generic.Dictionary<string, string> formParams,
             System.Collections.Generic.Dictionary<string, RestSharp.FileParameter> fileParams, 
             System.Collections.Generic.Dictionary<string, string> pathParams, 
             string contentType)

标签: c#.netasp.net-web-apiautodesk-forgerest-client

解决方案


如果您在此处查看源代码,它不会真正检查 null 或回退到任何默认值,因此您需要为不需要的 args 提供一个空值,例如

 CallApiAsync(“Your:Api/path/”, Method.GET, new Dictionary<string,string>(), new {}, ...)

推荐阅读