private static void getApplications(IoTDAClient client) { ShowApplicationsRequest req = new ShowApplicationsRequest { InstanceId = "1a7ffc5c-d89c-44dd-8265-b1653d951ce0" }; try { var resp = client.ShowApplications(req); Console.WriteLine(resp.HttpStatusCode); foreach (var App in resp.Applications) { Console.WriteLine(JsonConvert.SerializeObject(App)); } } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }
/// <summary> /// 查询资源空间列表 /// </summary> public async Task <ShowApplicationsResponse> ShowApplicationsAsync(ShowApplicationsRequest showApplicationsRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v5/iot/{project_id}/apps", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, showApplicationsRequest); HttpResponseMessage response = await DoHttpRequestAsync("GET", request); return(JsonUtils.DeSerialize <ShowApplicationsResponse>(response)); }