httpContent中的C#下划线

时间:2017-06-07 04:22:43

标签: c# dotnet-httpclient

Rally的APIKey以下划线开头。在尝试发布时,我得到了“错误请求”#34; Underscore无法从API Key中删除,因为它是由Rally生成的,如果没有下划线,则Rally不会授权。

var client = new HttpClient();
var pairs = new List<KeyValuePair<string, string>>
    {
        new KeyValuePair<string, string>("ArtifactUUID", "ID1"),
        new KeyValuePair<string, string>("UserUUID", "ID2"),
        new KeyValuePair<string, string>("zuul_key",  "**APIKey begins with underscore**")
    };

var content = new FormUrlEncodedContent(pairs);
var response = client.PostAsync("https://rally1.rallydev.com/notifications/api/v2/watch", content).Result;

0 个答案:

没有答案