因此,我正在尝试向Visa API发出过帐请求。它说我需要以下标题:
// Header
Accept: application/json,application/octet-stream
Authorization: {base64 encoded userid:password}
我相信我的设置如下所示
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
httpWebRequest.Accept = "application/json,application/octet-stream";
String username = "usernamehere";
String password = "passwordhere";
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
httpWebRequest.Headers.Add("Authorization",encoded);
但是,当我在邮递员上执行此操作时,我必须同时上传证书和密钥文件。当我这样做时,它适用于邮递员。我的猜测是因为我没有在这里这样做,所以没有用。有没有办法同时发送证书和密钥文件以及请求?
当我运行代码时,它给了我这个错误:
System.Net.WebException: 'The remote server returned an error: (500) Internal Server Error.'