C# is a general-purpose, multi-paradigm programming language. C# encompasses static typing, strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines. This tutorial is how to get live gold price using C# programming language.
REPLACE_ME
with your API key.base
value to a currency or remove this query param.currencies
value to a list of values or remove this query param. In the example below, you will get precious metal rates for gold, silver, palladium, and platinum.For 2 and 3, you can find this documented at Offical Documentation
var options = new RestClientOptions("https://api.metalpriceapi.com/v1/latest?api_key=REPLACE_ME&base=USD¤cies=XAU,XAG,EUR")
RestClient client = new RestClient(options);
RestRequest request = new RestRequest("", Method.Get);
RestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var client = new RestClient("https://api.metalpriceapi.com/v1/latest?api_key=REPLACE_ME&base=USD¤cies=XAU,XAG,EUR");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);