using Newtonsoft.Json; using RestSharp; namespace ConsoleApp10 { public class Root { public int code { get; set; } public string message { get; set; } public Data data { get; set; } } public class Data { public Table table { get; set; } } public class Table { public string table_id { get; set; } public string name { get; set; } public string alias { get; set; } public string space_id { get; set; } public string created_on { get; set; } public List fields { get; set; } } //public class Field //{ // public string? field_id { get; set; } // public string? name { get; set; } // public string? alias { get; set; } // public string? field_type { get; set; } // public string? data_type { get; set; } // public object? from_relation_field { get; set; } // public bool? required { get; set; } // public string? description { get; set; } // public object? config { get; set; } //} internal class Program { private static readonly string baseUrl = "https://api.huoban.com/"; private static readonly string API_Key = "FIQBLpReK6nAJ0CzYOxmNgKtEpa0cApctanSZyGW"; private static readonly string Space_Id = "4000000007643308"; private static readonly string Table_Id = "2100000061683453"; static void Main(string[] args) { // 创建 REST 客户端 var options = new RestClientOptions(baseUrl); var client = new RestClient(options); // 创建请求 var request = new RestRequest($"openapi/v1/table/{Table_Id}", Method.Post); // 添加授权头 request.AddHeader("Open-Authorization", $"Bearer {API_Key}"); request.AddHeader("Content-Type", "application/json"); // 执行请求 var response = client.Execute(request); Root USA = JsonConvert.DeserializeObject(response.Content); var llls = USA.data.table.fields; foreach (dynamic item in llls) { Console.WriteLine(item.name); Console.WriteLine(item.field_id); } Console.ReadLine(); Console.WriteLine("Hello, World!"); Console.WriteLine("Hello, World!"); } } }