# ConsulSharp **Repository Path**: hongjun45/ConsulSharp ## Basic Information - **Project Name**: ConsulSharp - **Description**: A set of c# API to call the consul HTTP API! - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-03-29 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ConsulSharp A set of c# API to call the consul HTTP API! consul http api:https://www.consul.io/api/index.html ![](https://github.com/axzxs2001/ConsulSharp/blob/master/ConsulSharp/ConsulSharp/ConsulSharp.png) ### Usage: Install-Package ConsulSharp -Version 0.1.1 ```c# /// /// Read Key /// private static void ReadKey() { var kvGovern = new KVGovern(); var result = kvGovern.ReadKey(new ReadKeyParmeter { Key = "lisconnectionstring" }).GetAwaiter().GetResult(); Console.WriteLine(EntityToString(result)); } /// /// List Nodes /// private static void ListNodes() { var catalogGovern = new CatalogGovern(); var result = catalogGovern.ListNodes(new ListNodesParmeter { DC = "dc1" }).GetAwaiter().GetResult(); Console.WriteLine(EntityToString(result)); } /// /// Register Service /// private static void RegisterService() { var agentGovern = new AgentGovern(); var result = agentGovern.RegisterServices(new RegisterServiceParmeter { ID = "test0001", Name = "test0001", Address = "http://165.125.1.12", Port = 80, Tags = new string[] { "His"} }).GetAwaiter().GetResult(); Console.WriteLine($"result={result.result}"); Console.WriteLine($"back content={result.backJson}"); } ```