[英]Using RestSharp Api with GustPay
I am trying to use RestSharp Api to use GustPay Api. 我正在尝试使用RestSharp Api使用GustPay Api。 I am confused how to pass “api_key” and “api_secret” in request.
我很困惑如何在请求中传递“ api_key”和“ api_secret”。
var client = new RestClient("https://www.gustpay.com/api/gust_pass_venue_assignment");
var request = new RestRequest(Method.POST)
{
RequestFormat = DataFormat.Json
};
request.AddBody(request.JsonSerializer.Serialize(new
{
venue_name = "Cape Town Stadium",
latitude = "-33.903441",
longitude = "18.41113"
}));
var response = client.Execute(request);
Console.WriteLine(response.Content);
You should be able to use request.AddParameter(...)
. 您应该可以使用
request.AddParameter(...)
。 Call it once for each of your three parameters: api_key, api_secret, and data. 为您的三个参数(api_key,api_secret和data)中的每一个调用一次。
Edited to add: RestSharp will add these parameters to the body of the request because it's a POST request. 编辑添加:RestSharp会将这些参数添加到请求的正文中,因为它是POST请求。 It would add them to the querystring instead if it were a GET requests, but that's not the case in your example.
如果是GET请求,则会将它们添加到查询字符串中,但是在您的示例中并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.