我正在尝试创建一个POST请求,但无法使其正常工作。
该请求的格式如下,包含3个参数:accountidentifier / type / seriesid
http://someSite.com/api/User_Favorites.php?accountid=accountidentifier&type=type&seriesid=seriesid
以下是我的C#代码:
using (var httpClient = new HttpClient())
{
httpClient.BaseAddress = new Uri("http://somesite.com");
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("accountidentifier", accountID),
new KeyValuePair<string, string>("type", "add"),
new KeyValuePair<string, string>("seriesid", seriesId),
});
httpClient.PostAsync("/api/User_Favorites.php", content);
}
有什么想法吗?
URI
的一部分(即在?
之后的查询部分),但你将它们作为content
发送。 - user1908061